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: 593
  • Category: Data Formats
  • Founded: Jul 19, 2005
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 859 - 889 of 1968   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#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]

#884 From: "Douglas Crockford" <douglas@...>
Date: Thu Oct 11, 2007 1:19 pm
Subject: Re: JSONRequest
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, John David Duncan <john.david.duncan@...>
wrote:

> 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.

You're right.

#885 From: "cisco_sethcall" <sethcall@...>
Date: Fri Oct 12, 2007 7:53 pm
Subject: Waiting on browsers?
cisco_sethcall
Send Email Send Email
 
I'm the type of person that is pretty impatient, and given the past
history of browsers with regards to adopting standards, I'm curious on
anyone's feelings on implementing JSONRequest before the browser's
officially do (obviously FF has a plugin but it's gotta be in IE at a
miminum before anyone seriously begins to adopt--also I'd say Safari
and then Opera would be pretty important overall).

I tend to think that we should just keep pushing the envelope and not
wait on browsers--I mean, after all, AJAX is just a ton of hacks and
workarounds pushing the current envelope to it's limit, and look what
interest it's created.  And like with XMLHTTPRequest, it got used
first and then became a standard... why not with JSON?

In my mind, there are really three ways to do it:

1) Build and maintain plugin for every major browser.
2) Build JSON on top of Flash flash.net.socket
3) Build JSON on top of Java Applet

And pro/cons of each:

1)
* Pro: No requirement on another technology
* Con: Installation process must be extremely painless. Failure to do
so is failure for widespread adoption. (Ask applets about this)
* Con: Personally not sure if every browser offers a plugin model deep
enough to implement JSON.
* Con: Have to build & maintain multiple plugins for wildly different
plugin models.

2)
* Pro: Flash is most ubiquitous of plugins
* Pro: Build on
* Pro: No security prompt for cross-domain requests.  (instead policy
file at root of origin domain indicates which other domains are
acceptable).
* Con: flash.net.socket does not support SSL (no indication if or when
that I can see), but one could build HTTP transport with it
* Con: XmlHTTPRequest within Flash uses same mechanism of browser,
which bothers me a bit because of max of 2 concurrent requests per
domain by default in IE/FF.  I assume one can't control cookies or all
headers as well with XHR either so that's a problem.

3)
* Pro: Java Applet is extremely capable as a development
environment--most powerful/most flexible.
* Con: Cross-domain requests required signed jar which require use to
click YES when the applet loads to security prompt.
* Con: not as widely adopted compared to Flash


With the later two solutions, one would have to build a javascript
bridge from the context of the flash player or applet.


Anyway, does any one have strong feelings about any of these 3
approaches, has a different idea, or thinks we should just wait for
browsers?

Seth

#886 From: "Kris Zyp" <kriszyp@...>
Date: Sat Oct 13, 2007 3:47 pm
Subject: Re: Digest Number 331
kriszyp
Send Email Send Email
 
JSON JavaScript Object NotationCisco, have you tried Subspace/CrossSafe
(http://www.xucia.com/page/CrossSafe)? It is a JS library that provides secure
cross-domain JSON requests using iframes and JSONP and implements part of the
JSONRequest spec, but defers to the plugin when it is available. You can add
that to your list of options.
Kris


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

#887 From: "Michael Schwarz" <michael.schwarz@...>
Date: Sun Oct 14, 2007 11:54 am
Subject: Re: Re: JSONRequest
schwarz_inte...
Send Email Send Email
 
Hi,

one thing I didn't get a answer yet about security: I expect that NTLM is
not working with JSONRequest, too, is that correct?

Some other questions while implementing a client plugin: must there be a
maximum timeout value? I think that it makes no sence to run requests longer
than 10 seconds. What about the user-agent string, will this be sent or not?
Why only send the domain, doesn't the complete Uri makes sence?

And one last question: does the JSON server need to support HTTP 1.0, or is
it mandatory to support HTTP 1.1 only?

Michael



On 10/11/07, Douglas Crockford <douglas@...> wrote:
>
>   --- In json@yahoogroups.com <json%40yahoogroups.com>, John David Duncan
> <john.david.duncan@...>
> wrote:
>
> > 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.
>
> You're right.
>
>
>



--
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.ajaxpro.info/

Skype: callto:schwarz-interactive
MSN IM: passport@...


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

#888 From: "Frans Thamura" <frans@...>
Date: Sun Oct 14, 2007 3:20 pm
Subject: JSON URLEncoder in Java
fthamura
Send Email Send Email
 
hi all

i am seeking an Java based of JSON that can convert JSON become URL,

this is called URLEncoder and URLDecoder,

anyone have it?

FransThamura
Indonesia

#889 From: "collin_jackson" <yahoo@...>
Date: Sun Oct 14, 2007 5:26 pm
Subject: Re: JSONRequest
collin_jackson
Send Email Send Email
 
--- In json@yahoogroups.com, "Michael Schwarz" <michael.schwarz@...>
wrote:
> Some other questions while implementing a client plugin:

Can you tell us which platform you are developing a client plugin for?

> Why only send the domain, doesn't the complete Uri makes sence?

The browser's security policy isn't granular enough to separate URIs
into separate security contexts, so it would be easy for a site to
spoof any URI within the page's a given domain by injecting script
tags into other pages. Also, in Firefox (for example) there are many
scenarios where a page has URI that does not specify a domain
(about:blank, or a javascript: URI) yet the page does have a domain
according to the browser.

To make this header match the browser's security policy, it would be
possible to set a header of the form scheme://domain:port (with no
path included), but I'm not sure whether this is necessary.

Messages 859 - 889 of 1968   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