Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

json · JSON JavaScript Object Notation

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 590
  • Category: Data Formats
  • Founded: Jul 19, 2005
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 853 - 883 of 1958   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#853 From: "Philip Tellis" <philip.tellis@...>
Date: Sun Aug 26, 2007 4:14 pm
Subject: Fwd: Comparing the metadata field with a variable passed
philiptellis
Send Email Send Email
 
On 26/08/07, mahesh_mission <mahesh_mission@...> wrote:
>
>  I have a JSON object which has a strcture like this :
>
>  { "MainData":
>       {
>
>               "Company":
>                       {
>                       "Name":"ABC Ltd",
>                       "Address":"<address>"
>                       },
>               "Data":
>                       {
>                               "001":
>                               {
>                                       "Name": "Test",
>                                       "Age":"45"
>                               },
>                               "002":
>                               {
>                                       "Name" : "Sample",
>                                       "Age":"35"
>                               }
>                       }
>               }
>  }
>
>  In this, "001", "002" are emloyee numbers.
>  Now assume the employee number is passed from an another function as
>  an input. (Let it be EmpNo)
>
>  Now, I need to check if the passed in employee number is present in
>  the JSON structure and accordingly retreive the data.
>
>  I need to use the javascript for this.
>  If I try to say
>
>       MainData.Company.Data.eval(EmpNo);

avoid using eval.  Just use the "in" operator"

if(EmpNo in MainData.Company.Data)

in checks for the existence of a key.


--
hello world

#854 From: "mahesh_mission" <mahesh_mission@...>
Date: Sun Aug 26, 2007 5:25 pm
Subject: Re: Fwd: Comparing the metadata field with a variable passed
mahesh_mission
Send Email Send Email
 
Hi,

It works fine now.
Thanks a lot for your timely help!!

--- In json@yahoogroups.com, "Philip Tellis" <philip.tellis@...>
wrote:
>
> On 26/08/07, mahesh_mission <mahesh_mission@...> wrote:
> >
> >  I have a JSON object which has a strcture like this :
> >
> >  { "MainData":
> >       {
> >
> >               "Company":
> >                       {
> >                       "Name":"ABC Ltd",
> >                       "Address":"<address>"
> >                       },
> >               "Data":
> >                       {
> >                               "001":
> >                               {
> >                                       "Name": "Test",
> >                                       "Age":"45"
> >                               },
> >                               "002":
> >                               {
> >                                       "Name" : "Sample",
> >                                       "Age":"35"
> >                               }
> >                       }
> >               }
> >  }
> >
> >  In this, "001", "002" are emloyee numbers.
> >  Now assume the employee number is passed from an another
function as
> >  an input. (Let it be EmpNo)
> >
> >  Now, I need to check if the passed in employee number is
present in
> >  the JSON structure and accordingly retreive the data.
> >
> >  I need to use the javascript for this.
> >  If I try to say
> >
> >       MainData.Company.Data.eval(EmpNo);
>
> avoid using eval.  Just use the "in" operator"
>
> if(EmpNo in MainData.Company.Data)
>
> in checks for the existence of a key.
>
>
> --
> hello world
>

#855 From: "Douglas Crockford" <douglas@...>
Date: Tue Aug 28, 2007 1:27 am
Subject: org.json.JSONObject.java
douglascrock...
Send Email Send Email
 
New constructors for JSONObject:

     JSONObject(Object bean)

         Make a new JSONObject from the getter methods of a bean.

     JSONObject(Object object, String names[])

         Make a new JSONObject using an array of keys to extract
         values from an Object.

New constructor for JSONArray:

     JSONArray(Object array)

         Make a new JSONArray from a Java array.

The toJSONString methods will attempt to produce JSON text for values
of type array, Collection, Map.

http://www.json.org/java/index.html

#856 From: Stefan Gössner <stefan@...>
Date: Tue Aug 28, 2007 3:25 pm
Subject: JSONPath
stefangoessner
Send Email Send Email
 
In the current process to improve JSONT I implemented a lightweight
component JSONPath, which compares a lot to XPath.

You can download it for Javascript and PHP

http://code.google.com/p/jsonpath/

and read more about it.

http://goessner.net/articles/JsonPath/

Comments are welcome .. thanks.

#857 From: "wefnewtrhewlkfd9" <Andrey_CD@...>
Date: Thu Aug 30, 2007 5:18 am
Subject: JsonV
wefnewtrhewl...
Send Email Send Email
 
JSONV- open-source format, based on jsons formats, as alternative to
xml,css,xslt,rdf,owl,html presentation of information for the dynamic
forming and transmission of content .More...
<http://semanticfind.com/jsonv>  


[Non-text portions of this message have been removed]

#858 From: Atif Aziz <atif.aziz@...>
Date: Fri Aug 31, 2007 10:47 pm
Subject: RE: JSONPath
azizatif
Send Email Send Email
 
JSONPath looks very promising and close in spirit to the simplicity and
effectiveness of JSON. I just finished an initial port and implementation in C#
(should compile and run on just about any platform where a decent C# compiler is
available) and which can now be downloaded [1] from the same project site, i.e.
http://code.google.com/p/jsonpath/ (thanks, Stefan). Comments and feedback
appreciated.

- Atif

[1] http://jsonpath.googlecode.com/files/jsonpath-0.5.0.cs

From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of Stefan
Gössner
Sent: Tuesday, August 28, 2007 5:26 PM
To: json@yahoogroups.com
Subject: [json] JSONPath


In the current process to improve JSONT I implemented a lightweight
component JSONPath, which compares a lot to XPath.

You can download it for Javascript and PHP

http://code.google.com/p/jsonpath/

and read more about it.

http://goessner.net/articles/JsonPath/

Comments are welcome .. thanks.



[Non-text portions of this message have been removed]

#859 From: "Douglas Crockford" <douglas@...>
Date: Sat Sep 1, 2007 11:42 pm
Subject: JSONRequest for Firefox
douglascrock...
Send Email Send Email
 
Collin Jackson has implemented a JSONRequest extention for Firefox.

http://crypto.stanford.edu/jsonrequest/

#860 From: "Frans Thamura" <frans@...>
Date: Tue Sep 4, 2007 2:38 am
Subject: Server Side: Receiving JSON
fthamura
Send Email Send Email
 
I have problem receive JSON in server

i want to use Servlet,

i try to use blabla?json?<json>

i got problem.

is the answer is JSONRPC?

anyone can help me to explain what is JSON RPC? and when will we use it

Frans

#861 From: "Henrik Hjelte" <henrik@...>
Date: Wed Sep 5, 2007 1:13 pm
Subject: Re: JSONPath
jagarenbrape...
Send Email Send Email
 
On 8/28/07, Stefan Gössner <stefan@...> wrote:

> In the current process to improve JSONT I implemented a lightweight
>  component JSONPath, which compares a lot to XPath.
>  Comments are welcome .. thanks.

I have a comment about the syntax. It is extremely easy to implement a
JSON parser because the syntax is simple. In not only looks good, it
is designed to be easy and good to implement.

For example, a string starts with a double-quote and ends with a
double-quote. So, when parsing a string there is only one character
that can end it. It makes the implementation trivial and fast.
The proposed syntax of JSONPath is not bad but a bit too ambivalent in
my opinion.

First, there is a choice of notation. It is simpler to select one and
stick to that.
And then the syntax is a bit more difficult than it should be.

The first syntax:
$.store.book[0].title

To end parsing a component you need to look for either a dot, an
opening square bracket or the end of line or the end of file

The bracket notation is easier.
$['store']['book'][0]['title']

To find the end of a component is easy, it ends with a single quote.
However there is another thing: after you have parsed an opening
bracket, you need to peek ahead at the following character to know if
it is a number or a string that follows.
Also, since json doesn't use single quotes but double quotes only, I
would use double quote to make it more similar. It might also make it
possible to reuse code in various json implementations.

My idea is the following syntax.
$"store"."book"[0]."title"

Just my two cents,
Henrik

#862 From: Stefan Gössner <stefan@...>
Date: Thu Sep 6, 2007 9:15 am
Subject: Re: JSONPath
stefangoessner
Send Email Send Email
 
> First, there is a choice of notation. It is simpler to select one and
> stick to that.
> And then the syntax is a bit more difficult than it should be.
>
> The first syntax:
> $.store.book[0].title
>
> To end parsing a component you need to look for either a dot, an
> opening square bracket or the end of line or the end of file
>
> The bracket notation is easier.
> $['store']['book'][0]['title']
>
> To find the end of a component is easy, it ends with a single quote.
> However there is another thing: after you have parsed an opening
> bracket, you need to peek ahead at the following character to know if
> it is a number or a string that follows.

One design criterion of the JSONPath syntax proposal is, that simple
expressions are also valid in Javascript. That applies to these two
expressions above. Extensions to that were modelled on E4X and ES4.

The parsing is not very expensive, when we use regular expressions.

> Also, since json doesn't use single quotes but double quotes only, I
> would use double quote to make it more similar. It might also make it
> possible to reuse code in various json implementations.

The idea to use JSONPath expressions inside of JSON structures
intensively seems to favor the choice of single quotes. See

{ "expr": "$['store']['book'][0]['title']" }

vs.

{ "expr": "$[\"store\"][\"book\"][0][\"title\"]" }

as an example, where we need to escape all double quotes.

> My idea is the following syntax.
> $"store"."book"[0]."title"

In fact this is also a valid JSONPath expression (with a dot after the
'$' though), but unfortunately not a valid Javascript expression.

As the JSONPath proposal is exactly that - a proposal, nothing is set
in stone. Thanks for your feedback.
--
Stefan

#863 From: John David Duncan <john.david.duncan@...>
Date: Sat Sep 22, 2007 8:16 pm
Subject: JSONRequest
jddefn
Send Email Send Email
 
Hi,

I'm interested in implementing the server side of JSONRequest, and
I'm a bit confused by the JSONRequest.get description in the proposal.

The sample server response says:

    HTTP/1.1 200 OK
    Content-Type: application/jsonrequest
    Content-Length: xxxx
    JSONRequest: 6

What is the "JSONRequest: 6" header?  Is 6 the request serial number?
(and if so, how did the server get the serial number from the client?)

Thanks,

JD

#864 From: "Douglas Crockford" <douglas@...>
Date: Sun Sep 23, 2007 12:19 am
Subject: Re: JSONRequest
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, John David Duncan <john.david.duncan@...>
wrote:

> I'm interested in implementing the server side of JSONRequest, and
> I'm a bit confused by the JSONRequest.get description in the proposal.

The current proposal can be found at http://json.org/JSONRequest.html

#865 From: John David Duncan <john.david.duncan@...>
Date: Sun Sep 23, 2007 1:07 am
Subject: Re: Re: JSONRequest
jddefn
Send Email Send Email
 
>
>> I'm interested in implementing the server side of JSONRequest, and
>> I'm a bit confused by the JSONRequest.get description in the
>> proposal.
>
> The current proposal can be found at http://json.org/JSONRequest.html

Yep, that's the one I'm referring to.  Is the "JSONRequest" header
supposed to be there, in this response?


    HTTP/1.1 200 OK
    Content-Type: application/jsonrequest
    Content-Length: xxxx
    JSONRequest: 6



JD

#866 From: "Douglas Crockford" <douglas@...>
Date: Sun Sep 23, 2007 3:27 am
Subject: Re: JSONRequest
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, John David Duncan <john.david.duncan@...>
wrote:
> Is the "JSONRequest" header
> supposed to be there, in this response?
>
>
>    HTTP/1.1 200 OK
>    Content-Type: application/jsonrequest
>    Content-Length: xxxx
>    JSONRequest: 6

I see what you mean. No, that isn't supposed to be there.
I have corrected it. Thank you.

#868 From: "mahesh_mission" <mahesh_mission@...>
Date: Wed Sep 26, 2007 2:19 pm
Subject: eval() throwing error in IE
mahesh_mission
Send Email Send Email
 
Hi,

I have a JSON object which has a strcture like this :

{ "MainData":
{

"Company":
{
"Name":"ABC Ltd",
"Address":"<address>"
},
"Data":
{
"001":
{
"Name": "Test",
"Age":"45"
},
"002":
{
"Name" : "Sample",
"Age":"35"
}
}
}
}

In this, "001", "002" are emloyee numbers.
Now assume the employee number is passed from an another function as
an input. (Let it be EmpNo)

Now, I need to check if the passed in employee number is present in
the JSON structure and accordingly retreive the data.

I need to use the javascript for this.
If I try to say

MainData.Company.Data.eval(EmpNo);

This works fine in mozilla.

But if I run the same program in IE, I get an error message "object
doesn't support this property or method".

I found that the eval() in this case doesn't work in IE. Could you
please suggest a solution.

Thanks a lot.

#869 From: "Douglas Crockford" <douglas@...>
Date: Thu Sep 27, 2007 1:36 pm
Subject: Re: eval() throwing error in IE
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, "mahesh_mission" <mahesh_mission@...> wrote:

> If I try to say
>
> MainData.Company.Data.eval(EmpNo);
>
> This works fine in mozilla.
>
> But if I run the same program in IE, I get an error message "object
> doesn't support this property or method".

That form of eval is not in the ECMAScript standard. I recommend that
you stick with the standard language.

#870 From: "kriszyp" <kriszyp@...>
Date: Thu Sep 27, 2007 4:39 pm
Subject: Re: eval() throwing error in IE
kriszyp
Send Email Send Email
 
I think you want:
MainData.Company.Data[EmpNo]

#871 From: "Julian Tonti-Filippini" <tontis@...>
Date: Wed Oct 3, 2007 7:16 am
Subject: Re: json.js
mediocritass
Send Email Send Email
 
I wanted to modify json.js to add RegExp support so I added the following:

RegExp.prototype.toJSONString = function () {
     return this.toString().toJSONString();
};

...and found that it didn't work under Firefox because the typeof
RegExp is 'function' rather than 'object'. This required modification
of the switch in Object.prototype.toJSONString to add a fall-through
case for 'function'.

My gut tells me that there's something criminally wrong about does
this. Can someone tell me why?

- Julian

#872 From: Brautaset Stig <stig@...>
Date: Wed Oct 3, 2007 1:18 pm
Subject: examples of valid but "problematic" JSON?
stigbrau
Send Email Send Email
 
Do you have a piece of (valid!) JSON that some JSON parsers find
difficult to parse? If you do, I'd love to get my hands on it.

I'm writing a JSON framework[0] in Objective-C for use in Cocoa on
Mac OS X and I want your help to make sure that I'm handling all
cases correctly.

[0] http://code.brautaset.org/JSON/

Stig
--
http://blog.brautaset.org
http://code.brautaset.org





[Non-text portions of this message have been removed]

#873 From: "Henrik Hjelte" <henrik@...>
Date: Wed Oct 3, 2007 2:00 pm
Subject: Re: examples of valid but "problematic" JSON?
jagarenbrape...
Send Email Send Email
 
On 10/3/07, Brautaset Stig <stig@...> wrote:
>
> Do you have a piece of (valid!) JSON that some JSON parsers find
>  difficult to parse? If you do, I'd love to get my hands on it.
>
>  I'm writing a JSON framework[0] in Objective-C for use in Cocoa on
>  Mac OS X and I want your help to make sure that I'm handling all
>  cases correctly.

The Json checker contains testcases you can use. If all tests pass, I
would be  confident that everything works ok.

Get the testcases here:  http://www.json.org/JSON_checker/test.zip

/Henrik Hjelte

#874 From: Gaetano Giunta <giunta.gaetano@...>
Date: Wed Oct 3, 2007 5:10 pm
Subject: Re: examples of valid but "problematic" JSON?
gaetanogiunt...
Send Email Send Email
 
I tested php json parsers using the test cases you can find here:
http://gggeek.altervista.org/sw/article_20070425.html

I personally prefer the parser to accept not only valid json strings,
but all things that browsers accept as valid to build javascript anon
objects.

Gaetano

> Do you have a piece of (valid!) JSON that some JSON parsers find
> difficult to parse? If you do, I'd love to get my hands on it.
>
> I'm writing a JSON framework[0] in Objective-C for use in Cocoa on
> Mac OS X and I want your help to make sure that I'm handling all
> cases correctly.
>
> [0] http://code.brautaset.org/JSON/ <http://code.brautaset.org/JSON/>
>
> Stig
> --
> http://blog.brautaset.org <http://blog.brautaset.org>
> http://code.brautaset.org <http://code.brautaset.org>
>
> [Non-text portions of this message have been removed]
>
>



[Non-text portions of this message have been removed]

#875 From: Stig Brautaset <stig@...>
Date: Wed Oct 3, 2007 7:49 pm
Subject: Re: examples of valid but "problematic" JSON?
stigbrau
Send Email Send Email
 
Hi Henrik,

On 3 Oct 2007, at 15:00, Henrik Hjelte wrote:
> On 10/3/07, Brautaset Stig <stig@...> wrote:
>>  I'm writing a JSON framework[0] in Objective-C for use in Cocoa on
>>  Mac OS X and I want your help to make sure that I'm handling all
>>  cases correctly.
>
> The Json checker contains testcases you can use. If all tests pass, I
> would be  confident that everything works ok.
>
> Get the testcases here:  http://www.json.org/JSON_checker/test.zip

Wow! That's great. Checking whether I pass these (and making sure I
do, if I don't already) is next on my agenda.

Stig

--
http://code.brautaset.org
http://blog.brautaset.org




[Non-text portions of this message have been removed]

#876 From: "Douglas Crockford" <douglas@...>
Date: Fri Oct 5, 2007 9:31 pm
Subject: json.js
douglascrock...
Send Email Send Email
 
A new version of json.js is available. It corrects a problem in
parseJSON where it was possible to have the contents of one of the
caller's variables included in the decoded value.

http://www.JSON.org/json.js

#877 From: "ketan_vjti" <ketan.khairnar@...>
Date: Sat Oct 6, 2007 5:26 am
Subject: JSON Utility using ASM
ketan_vjti
Send Email Send Email
 
#878 From: "kriszyp" <kriszyp@...>
Date: Sat Oct 6, 2007 4:24 pm
Subject: JSON Schema
kriszyp
Send Email Send Email
 
I have been working on putting together a proposal for a JSON Schema. I
have been collaborating with some others, but I wanted to elicit
feedback, input, and suggestions from the JSON group. The current
proposal which is definitely still a work in progress is at:
http://www.json.com/json-schema-proposal/
and some questions/issues are at:
http://www.json.com/2007/10/02/json-schema-proposal-rfc/

JSON Schema is a specification for a JSON-based format for defining the
structure of JSON data. JSON Schema provides a contract for what JSON
data is required for a given application and how it can be modified,
much like what XML Schema provides for XML. JSON Schema is intended to
provide validation, documentation, and interaction control of JSON data.

#879 From: "Kris Zyp" <kriszyp@...>
Date: Wed Oct 10, 2007 4:26 pm
Subject: JSON referencing (circular referencing and otherwise)
kriszyp
Send Email Send Email
 
I wanted to initiate some dialogue about JSON referencing conventions. I did
a write up at http://www.json.com/2007/10/09/json-referencing-schemes/ on a
number of the different proposed approaches to doing referencing (most are
for the the purpose of circular referencing), and I wanted to elicit
feedback on these approaches and hopefully be able to converge as community
on a consistent convention for referencing in JSON.
Thanks,
Kris


[Non-text portions of this message have been removed]

#880 From: John David Duncan <john.david.duncan@...>
Date: Wed Oct 10, 2007 8:36 pm
Subject: Re: Re: JSONRequest
jddefn
Send Email Send Email
 
On Sep 22, 2007, at 8:27 PM, Douglas Crockford wrote:

>> Is the "JSONRequest" header
>> supposed to be there, in this response?
>>    ...
> I see what you mean. No, that isn't supposed to be there.
> I have corrected it. Thank you.


Thanks!  I have one more thought about the proposal.

The Firefox plugin chooses to send an "Accept: application/
jsonrequest" header with the request, and I agree with this idea.
The proposal says that if the request is application/jsonrequest,
then the response must also be application/jsonrequest; the Accept
header spells out this requirement plainly in HTTP.   In my opinion,
the header should be mandatory.


JD

#881 From: "Douglas Crockford" <douglas@...>
Date: Wed Oct 10, 2007 10:34 pm
Subject: json.js
douglascrock...
Send Email Send Email
 
A design error in Firefox could allow parseJSON to include an eval
function object in the resulting JSON object. This situation will now
raise an exception.

http://www.JSON.org/json.js

#882 From: "mahesh_mission" <mahesh_mission@...>
Date: Thu Oct 11, 2007 5:19 am
Subject: Accessing a JSON element name (metadata)
mahesh_mission
Send Email Send Email
 
Hi,

I have a JSON object whose structure is like this:

The name of the object is 'Emp' and the attributes are:
name
age
sex
department
address

Later in my javascript code, I have to check if the JSON object's
value matches with my local value. For this I have to check

if (Emp.name == localvar.name) ...
if (Emp.age == localvar.age) ...

But the problem is I cannot know which of the attributes will come
first for comparison, as no predefined order is allowed.
So I have to first find out the current element of 'Emp' and
accordingly compare the local variable with it.
The problem is I cann't find the current element. Can someone pls
tell me a way.

Thanks.

#883 From: Mark Ireland <markincuba@...>
Date: Thu Oct 11, 2007 7:00 am
Subject: RE: Accessing a JSON element name (metadata)
akaidr4vr
Send Email Send Email
 
Will this work?

Emp["localvar.name"]


To: json@...: mahesh_mission@...: Thu, 11 Oct 2007
05:19:55 +0000Subject: [json] Accessing a JSON element name (metadata)




Hi,I have a JSON object whose structure is like this:The name of the object is
'Emp' and the attributes are:nameagesexdepartmentaddressLater in my javascript
code, I have to check if the JSON object's value matches with my local value.
For this I have to checkif (Emp.name == localvar.name) ...if (Emp.age ==
localvar.age) ...But the problem is I cannot know which of the attributes will
come first for comparison, as no predefined order is allowed. So I have to first
find out the current element of 'Emp' and accordingly compare the local variable
with it.The problem is I cann't find the current element. Can someone pls tell
me a way.Thanks.






_________________________________________________________________
It's simple! Sell your car for just $30 at CarPoint.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom\
%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F8596\
41&_t=762955845&_r=tig_OCT07&_m=EXT

[Non-text portions of this message have been removed]

Messages 853 - 883 of 1958   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help