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 839 - 869 of 1954   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#839 From: "ericazhangjun" <ericazhangjun@...>
Date: Wed Aug 1, 2007 3:41 pm
Subject: How to remove the script dynamically added ?
ericazhangjun
Send Email Send Email
 
Hi,
Now I built some mashup using JSON. Sometimes, I want to block the
script to be executed. I want to remove the script dynamically added
to prevent it from execution. Is there some way for me to do this ?

Or, if you  have other idea to implement this function, coul d you
share it with me ?

Thanks a lot.

#840 From: "Douglas Crockford" <douglas@...>
Date: Sun Aug 5, 2007 8:25 pm
Subject: json.js
douglascrock...
Send Email Send Email
 
I changed the way that json.js calls the hasOwnProperty method. A
design flaw in JavaScript causes hasOwnProperty to fail when an object
contains a property called "hasOwnProperty".

http://json.org/json.js

#841 From: "rui.maciel" <rui.maciel@...>
Date: Wed Aug 8, 2007 4:35 pm
Subject: MJSON v0.5 released
rui.maciel
Send Email Send Email
 
I'm proud to announce that MJSON v0.5 has been released!

MJSON is Maciel's JSON parser, a small light-weight library that
handles documents written in the JSON markup language. It's written in
ISO C, which means that it may run wherever there is a C compiler.

This new release is mainly a cleanup release to mark the begining of
the library's beta stage.

MJSON can be found at:
http://sourceforge.net/projects/mjson


Rui Maciel

#842 From: "genzoeri" <genzoeri@...>
Date: Wed Aug 15, 2007 1:48 am
Subject: [question] parse json with ajax
genzoeri
Send Email Send Email
 
Hi,I have difficulties to parse this json
{depth1:{depth2:{depth3:'content'}}}
how to get the 'content'?? using ajax?

#843 From: Crzy4C <Crzy4c@...>
Date: Wed Aug 15, 2007 2:04 am
Subject: Re: [question] parse json with ajax
crzy4c
Send Email Send Email
 
well you don't get "content" using ajax. You get "content" using
javascript...
if that json string was assigned to a variable foo...
var foo = {depth1 : { depth2 : {depth3 : 'content'}}};
and you set...
var foo1 = foo.depth1.depth2.depth3;
then the value of foo1 would be 'content;

Mike

genzoeri wrote:
>
> Hi,I have difficulties to parse this json
> {depth1:{depth2:{depth3:'content'}}}
> how to get the 'content'?? using ajax?
>
>



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

#844 From: "Martin Cooper" <mfncooper@...>
Date: Wed Aug 15, 2007 2:11 am
Subject: Re: [question] parse json with ajax
mfncooper
Send Email Send Email
 
On 8/14/07, genzoeri <genzoeri@...> wrote:
>
> Hi,I have difficulties to parse this json
> {depth1:{depth2:{depth3:'content'}}}


That's not valid JSON, for two reasons:

1) Key names are strings, and must be quoted as such.
2) Strings must be quoted with double quotes, not single quotes.

See http://json.org/ for the JSON specification.

--
Martin Cooper


how to get the 'content'?? using ajax?
>
>
>
>
> Yahoo! Groups Links
>
>
>
>


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

#845 From: "genzoeri" <genzoeri@...>
Date: Wed Aug 15, 2007 6:34 am
Subject: Re: [question] parse json with ajax
genzoeri
Send Email Send Email
 
I will use this for my AJAX. Using responsetext properties from XHR.
:) ok,then how to parse, {"depth1":{"depth2":{"depth3":"content"}}} ??
btw, thank you for your response. I am glad, I am on the right place.
--- In json@yahoogroups.com, "Martin Cooper" <mfncooper@...> wrote:
>
> On 8/14/07, genzoeri <genzoeri@...> wrote:
> >
> > Hi,I have difficulties to parse this json
> > {depth1:{depth2:{depth3:'content'}}}
>
>
> That's not valid JSON, for two reasons:
>
> 1) Key names are strings, and must be quoted as such.
> 2) Strings must be quoted with double quotes, not single quotes.
>
> See http://json.org/ for the JSON specification.
>
> --
> Martin Cooper
>
>
> how to get the 'content'?? using ajax?
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>

#846 From: Mark Ireland <markincuba@...>
Date: Wed Aug 15, 2007 6:58 am
Subject: RE: [question] parse json with ajax
akaidr4vr
Send Email Send Email
 
Key names must be quoted and cant start with a number?Is that right?To:
json@...: mfncooper@...: Tue, 14 Aug 2007 19:11:32
-0700Subject: Re: [json] [question] parse json with ajax


















             On 8/14/07, genzoeri <genzoeri@...> wrote:
>
> Hi,I have difficulties to parse this json
> {depth1:{depth2:{depth3:'content'}}}

That's not valid JSON, for two reasons:

1) Key names are strings, and must be quoted as such.
2) Strings must be quoted with double quotes, not single quotes.

See http://json.org/ for the JSON specification.

--
Martin Cooper

how to get the 'content'?? using ajax?
>
>
>
>
> Yahoo! Groups Links
>
>
>
>

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
















_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE

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

#847 From: Michal Migurski <mike-jsonphp@...>
Date: Wed Aug 15, 2007 8:09 am
Subject: Re: Re: [question] parse json with ajax
michal_migurski
Send Email Send Email
 
On Aug 14, 2007, at 11:34 PM, genzoeri wrote:
> I will use this for my AJAX. Using responsetext properties from XHR.
> :) ok,then how to parse, {"depth1":{"depth2":{"depth3":"content"}}} ??
> btw, thank you for your response. I am glad, I am on the right place.

This should help:
	 eval("var responsejson = (" + responsetext + ");");
	 alert(responsejson['depth1']['depth2']['depth3'];



On Aug 14, 2007, at 11:58 PM, Mark Ireland wrote:
> Key names must be quoted and cant start with a number?Is that right?

Yes.

-mike.

----------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

#848 From: "Philip Tellis" <philip.tellis@...>
Date: Thu Aug 16, 2007 5:05 am
Subject: Re: Re: [question] parse json with ajax
philiptellis
Send Email Send Email
 
On 15/08/07, Michal Migurski <mike-jsonphp@...> wrote:
>
>  This should help:
>   eval("var responsejson = (" + responsetext + ");");
>   alert(responsejson['depth1']['depth2']['depth3'];

Ugh, don't do that.  Apart from screwing with the scope of
responsejson, it also causes a security problem, and it's overkill.
If you must use eval, do it this way:

var responsejson = eval( "(" + o.responseText + ")" );

That won't take away the security problems with eval, but it will make
sure that responsejson is in current scope.

#849 From: "Shorthouse, David" <dps1@...>
Date: Sun Aug 19, 2007 2:26 am
Subject: multiple, identical callbacks
davidpshorth...
Send Email Send Email
 
Hello folks,



First, I'm relatively new to working with JSON so please bear with me.
Here's the situation:



I am attempting to use multiple callbacks all from the same provider, but of
course, overlapped onclick events steal each other's scopes.the removeChild
function wouldn't have yet had a chance to complete before the next onclick
event initiates so it "steals" the contents of the callback function.



To make sense of what I am talking about, imagine using many JSON Flickr
callbacks in rapid succession with the hopes of having the outputs appear in
different divisions on one page. To see what I am talking about, have a peek
at a development page I am working on & attempt to click the search icons
beside references by Archer between 1950 & 1958 in rapid succession on
http://canadianarachnology.dyndns.org/data/canada_spiders/AllReferences2.asp
. Note that the JSON provider (not Flickr of course) is still working on his
JSON-generating function, so please stick to those references to fire the
onclick call.other onclicks to call the provider may return XML instead of
JSON. Note also that the above URL will return a 404 once I figure out how
best to do this. I guess what I'm after is a method to alert the user to
wait for a callback to complete before he/she attempts to initiate a second
one because the removeChild wouldn't have yet had a chance to clear the
callback function from their browser page's head section. Is this at all
possible?



Any help would be most appreciated,



David P. Shorthouse

------------------------------------------------------

Department of Biological Sciences

CW-403, Biological Sciences Centre

University of Alberta

Edmonton, AB   T6G 2E9

http://canadianarachnology.webhop.net

http://arachnidforum.webhop.net

http://www.spiderwebwatch.org <http://www.spiderwebwatch.org/>
------------------------------------------------------





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

#850 From: "Douglas Crockford" <douglas@...>
Date: Sun Aug 19, 2007 2:58 pm
Subject: json.js
douglascrock...
Send Email Send Email
 
The toJSONString methods can now take an optional whitelist parameter,
an array of strings. It is used to select the properties that will be
included in the JSON text.

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

#851 From: "Douglas Crockford" <douglas@...>
Date: Sat Aug 25, 2007 10:40 am
Subject: json-nl
douglascrock...
Send Email Send Email
 
The JSON.org page is now available in Dutch.

http://json.org/json-nl.html

#852 From: "mahesh_mission" <mahesh_mission@...>
Date: Sun Aug 26, 2007 12:59 pm
Subject: Comparing the metadata field with a variable passed
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 if the EmpNo is 001 or 002.
But if the EmpNo is 135, which is not present in the JSON output, it
throws an error.

How I can check that the input EmpNo is present in the JSON
structure.(This needs to be done in javascript)
Any help would be greatly appreciated.

Thanks in advance for the answer.

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

Messages 839 - 869 of 1954   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