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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 307 - 336 of 1958   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#307 From: "Ryan Huff" <routeslip@...>
Date: Mon Apr 3, 2006 1:42 am
Subject: "Invalid Label" error
ryanhca
Send Email Send Email
 
Hello. Ordinarily I wouldn't ask others to debug a problem I'm having
with MY code, but I'm stuck. Being a total newbie to JSON, I'm afraid
I don't have enough experience to understand what this error means.

When I eval the json string, FireFox gives me an error that simply
says "Invalid label" (and points to the ':' between "mapid" and "1").

here's my code:

	 var json =
eval('{"mapid":"1","us_metric":"us","out_and_back":"0","rspoints":[{"key":"-117.\
8695678711_33.7391868646","lat":"33.7391868646","long":"-117.8695678711","order"\
:"0","type":"point","turn":"null","street":"null","elevation":"99.3","distance":\
"0.00","previous":"","next":"-117.9176330566_33.6271985166"},{"key":"-117.917633\
0566_33.6271985166","lat":"33.6271985166","long":"-117.9176330566","order":"1","\
type":"point","turn":"null","street":"null","elevation":"94.3","distance":"0.00"\
,"previous":"-117.8695678711_33.7391868646","next":"-117.6635742187_33.610044573\
7"},{"key":"-117.6635742187_33.6100445737","lat":"33.6100445737","long":"-117.66\
35742187","order":"2","type":"point","turn":"null","street":"null","elevation":"\
482.9","distance":"0.00","previous":"-117.9176330566_33.6271985166","next":""}],\
"center_lat":"33.674615719150","center_long":"-117.790603637650","zoom":7,"first\
_point_key":"33.7391868646_-117.8695678711","last_point_key":"-117.6635742187_33\
.6100445737"}');

A more legible version of this string is:
{
	 "mapid":"1",
	 "us_metric":"us",
	 "out_and_back":"0",
	 "rspoints":[
		 {
			 "key":"-117.8695678711_33.7391868646",
			 "lat":"33.7391868646",
			 "long":"-117.8695678711",
			 "order":"0",
			 "type":"point",
			 "turn":"null",
			 "street":"null",
			 "elevation":"99.3",
			 "distance":"0.00",
			 "previous":"",
			 "next":"-117.9176330566_33.6271985166"
		 },
		 {
			 "key":"-117.9176330566_33.6271985166",
			 "lat":"33.6271985166",
			 "long":"-117.9176330566",
			 "order":"1",
			 "type":"point",
			 "turn":"null",
			 "street":"null",
			 "elevation":"94.3",
			 "distance":"0.00",
			 "previous":"-117.8695678711_33.7391868646",
			 "next":"-117.6635742187_33.6100445737"
		 },
		 {
			 "key":"-117.6635742187_33.6100445737",
			 "lat":"33.6100445737",
			 "long":"-117.6635742187",
			 "order":"2",
			 "type":"point",
			 "turn":"null",
			 "street":"null",
			 "elevation":"482.9",
			 "distance":"0.00",
			 "previous":"-117.9176330566_33.6271985166",
			 "next":""
		 }
	 ],

	 "center_lat":"33.674615719150",
	 "center_long":"-117.790603637650",
	 "zoom":7,
	 "first_point_key":"33.7391868646_-117.8695678711",
	 "last_point_key":"-117.6635742187_33.6100445737"
}

Thanks for your help!

#308 From: Pavan Kumar Keely <keelypavan@...>
Date: Mon Apr 3, 2006 3:06 am
Subject: Re: "Invalid Label" error
keelypavan
Send Email Send Email
 
Hi Ryan,

   When you eval a json string, enclose that string in between "(" and ")". So,
to correct your example, the json part of the eval statement would be:

        var json =
eval('('+'{"mapid":"1","us_metric":"us","out_and_back":"0","rspoints":[{"key":"-\
117.8695678711_33.7391868646","lat":"33.7391868646","long":"-117.8695678711","or\
der":"0","type":"point","turn":"null","street":"null","elevation":"99.3","distan\
ce":"0.00","previous":"","next":"-117.9176330566_33.6271985166"},{"key":"-117.91\
76330566_33.6271985166","lat":"33.6271985166","long":"-117.9176330566","order":"\
1","type":"point","turn":"null","street":"null","elevation":"94.3","distance":"0\
.00","previous":"-117.8695678711_33.7391868646","next":"-117.6635742187_33.61004\
45737"},{"key":"-117.6635742187_33.6100445737","lat":"33.6100445737","long":"-11\
7.6635742187","order":"2","type":"point","turn":"null","street":"null","elevatio\
n":"482.9","distance":"0.00","previous":"-117.9176330566_33.6271985166","next":"\
"}],"center_lat":"33.674615719150","center_long":"-117.790603637650","zoom":7,"f\
irst_point_key":"33.7391868646_-117.8695678711","last_point_key":"-117.663574218\
7_33.6100445737"}' + ')' );

   I separated "(" and ")" because I think you may be getting this json string
dynamically form a server response.

   Please feel free to contact again if it doesn;t work.

   Pavan Keely


Ryan Huff <routeslip@...> wrote:
   Hello. Ordinarily I wouldn't ask others to debug a problem I'm having
with MY code, but I'm stuck. Being a total newbie to JSON, I'm afraid
I don't have enough experience to understand what this error means.

When I eval the json string, FireFox gives me an error that simply
says "Invalid label" (and points to the ':' between "mapid" and "1").

here's my code:

       var json =
eval('{"mapid":"1","us_metric":"us","out_and_back":"0","rspoints":[{"key":"-117.\
8695678711_33.7391868646","lat":"33.7391868646","long":"-117.8695678711","order"\
:"0","type":"point","turn":"null","street":"null","elevation":"99.3","distance":\
"0.00","previous":"","next":"-117.9176330566_33.6271985166"},{"key":"-117.917633\
0566_33.6271985166","lat":"33.6271985166","long":"-117.9176330566","order":"1","\
type":"point","turn":"null","street":"null","elevation":"94.3","distance":"0.00"\
,"previous":"-117.8695678711_33.7391868646","next":"-117.6635742187_33.610044573\
7"},{"key":"-117.6635742187_33.6100445737","lat":"33.6100445737","long":"-117.66\
35742187","order":"2","type":"point","turn":"null","street":"null","elevation":"\
482.9","distance":"0.00","previous":"-117.9176330566_33.6271985166","next":""}],\
"center_lat":"33.674615719150","center_long":"-117.790603637650","zoom":7,"first\
_point_key":"33.7391868646_-117.8695678711","last_point_key":"-117.6635742187_33\
.6100445737"}');
A more legible version of this string is:
{
       "mapid":"1",
       "us_metric":"us",
       "out_and_back":"0",
       "rspoints":[
             {
                   "key":"-117.8695678711_33.7391868646",
                   "lat":"33.7391868646",
                   "long":"-117.8695678711",
                   "order":"0",
                   "type":"point",
                   "turn":"null",
                   "street":"null",
                   "elevation":"99.3",
                   "distance":"0.00",
                   "previous":"",
                   "next":"-117.9176330566_33.6271985166"
             },
             {
                   "key":"-117.9176330566_33.6271985166",
                   "lat":"33.6271985166",
                   "long":"-117.9176330566",
                   "order":"1",
                   "type":"point",
                   "turn":"null",
                   "street":"null",
                   "elevation":"94.3",
                   "distance":"0.00",
                   "previous":"-117.8695678711_33.7391868646",
                   "next":"-117.6635742187_33.6100445737"
             },
             {
                   "key":"-117.6635742187_33.6100445737",
                   "lat":"33.6100445737",
                   "long":"-117.6635742187",
                   "order":"2",
                   "type":"point",
                   "turn":"null",
                   "street":"null",
                   "elevation":"482.9",
                   "distance":"0.00",
                   "previous":"-117.9176330566_33.6271985166",
                   "next":""
             }
       ],

       "center_lat":"33.674615719150",
       "center_long":"-117.790603637650",
       "zoom":7,
       "first_point_key":"33.7391868646_-117.8695678711",
       "last_point_key":"-117.6635742187_33.6100445737"
}

Thanks for your help!





---------------------------------
   YAHOO! GROUPS LINKS


     Visit your group "json" on the web.

     To unsubscribe from this group, send an email to:
  json-unsubscribe@yahoogroups.com

     Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


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





---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.

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

#309 From: "dnc_octopus" <DCarreira@...>
Date: Wed Apr 5, 2006 8:08 pm
Subject: json.parse returns false or error with valid strings on server-side JS
dnc_octopus
Send Email Send Email
 
Hi.

I'm trying to use json.parse on server-side javascript under IIS.
This gives errors or returns false with "perfectly good" json strings.

The process is to send a json.stringified text via ajax to a asp page.
This in turn has an include of json.asp (with just <% %> added).

I get the stringified text and pass it to JSON.parse. False is
returned or an error saying the object does not support this method.

Am I doing something wrong or json.js simply cannot by used by
server-side IIS JScript?

Thanks,
Duarte

#310 From: Lindsay <lindsay@...>
Date: Wed Apr 5, 2006 11:20 pm
Subject: Re: json.parse returns false or error with valid strings on server-side JS
softlog_lindsay
Send Email Send Email
 
dnc_octopus wrote:
> Hi.
>
>
> I get the stringified text and pass it to JSON.parse. False is
> returned or an error saying the object does not support this method.
>

Post some json that fails and you source that calls the parser.


--
Lindsay

#311 From: "dnc_octopus" <DCarreira@...>
Date: Thu Apr 6, 2006 7:13 pm
Subject: Re: json.parse returns false or error with valid strings on server-side JS
dnc_octopus
Send Email Send Email
 
--- In json@yahoogroups.com, Lindsay <lindsay@...> wrote:
>
> dnc_octopus wrote:
> > Hi.
> >
> >
> > I get the stringified text and pass it to JSON.parse. False is
> > returned or an error saying the object does not support this method.
> >
>
> Post some json that fails and you source that calls the parser.
>
>
> --
> Lindsay
>

Ok.
I build an object like this on the client side just for testing:
function fazJSON()
{
   var mObj = new Object;
   mObj.Time = new Date().getTime();
   mObj.Data = new Date().toUTCString();
   return JSON.stringify(mObj);
}

Then I pass this object to AJAX.Request (from prototype lib):
new Ajax.Request ('teste.asp',
   {
   method: 'get',
   parameters: 'pedido=' + objJSN,
   onSuccess: procResp,
   onFailure: procErro
   }
);


On the server I get the request using the QueryString, and pass it to
JSON.parse:

strReq = Request.QueryString("pedido");
respObj = JSON.parse(strReq);
if(respObj == false) {
	 Response.Write('JSON returned False');
	 Response.End;
}

The following are examples of json strings (produced by JSON) that
return false from JSON.parse on the server:
{"Time":1144349903406,"Data":"Thu, 06 Apr 2006 18:58:23 GMT"}
{"Data":"Thu, 06 Apr 2006 19:05:50 GMT"}
{"url":{"hash":"","host":"dnc1","hostname":"dnc1","href":"http://dnc1/evsig2/tes\
te.html","pathname":"/evsig2/teste.html","port":"","protocol":"http:","search":"\
"}}

But if I eval the strings it's ok.

Also, a last detail. On the server page I use:
<%@ language="javascript"%>
<!--#include virtual="/evsig2/server/json.asp"-->
<%
...rest of the program goes here...
%>

If there's any other info that's relevant just let me know.
Duarte

#312 From: "Mark S. Miller" <markm@...>
Date: Sat Apr 8, 2006 12:36 am
Subject: Article in Java Developer's Journal: "[...] JSON versus XML"
capsecure
Send Email Send Email
 
http://java.sys-con.com/read/203935.htm

--
Text by me above is hereby placed in the public domain

      Cheers,
      --MarkM

#313 From: "Nels Wadycki" <nwadycki@...>
Date: Sat Apr 8, 2006 7:50 pm
Subject: Re: Article in Java Developer's Journal: "[...] JSON versus XML"
nelswadycki
Send Email Send Email
 
Got that one in one of my RSS feeds.  It's a good read.

Nels

On 4/7/06, Mark S. Miller <markm@...> wrote:
>
> http://java.sys-con.com/read/203935.htm
>
> --
> Text by me above is hereby placed in the public domain
>
>      Cheers,
>      --MarkM
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


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

#314 From: "Atif Aziz" <atif.aziz@...>
Date: Mon Apr 10, 2006 11:09 am
Subject: JsonReader (C#): Non-cached, forward-only access to JSON data
azizatif
Send Email Send Email
 
I have added a JSON text parser, called JsonTextReader, that provides
non-cached, forward-only access to JSON data. JsonTextReader [1] can be
found in the Jayrock project from version 1.0.7507 onwards. I am
mentioning it here in case other libraries may be interested in a
similar approach.

Background:

When I originally started with the Jayrock project, I took off by
porting the Java JSONTokener implementation [2] to C# and re-factored it
such that it outputs the abstract JSON type system (embodied in
IParserOutput) as opposed to specific classes like JSONObject [3] and
JSONArray [4]. With JsonTextReader, I've got JSONTokener in the final
form I had planned originally. JsonTextReader basically takes
JSONTokener and turns its implementation into a yield/continuation
approach where it does the heavy-lifting of running a state machine
internally instead of requiring it from its users. With a non-caching
and forward-only approach, JsonTextReader also allows you to rip through
large JSON text without incurring the cost of building an in-memory
object graph if all you're interested in is just some pieces of data.
Here's an example that build a list of servlet names (see also full
example in the test case called "Shred" [5]):

JsonReader reader = new JsonTextReader(
   new StringReader(text));

ArrayList names = new ArrayList();

while (reader.Read())
{
     if (reader.Token == JsonToken.Member &&
         reader.Text == "servlet-name")
         items.Add(reader.ReadString());
}

I noticed that JSONObject has been enhanced to be even more liberal in
its lexical space, so I have updated the C# implementation similarly. I
have also added a Jayrock-JSON solution/project for those who wish to
use the JSON-only pieces of Jayrock without importing all the JSON-RPC
baggage.

[1] http://tinyurl.com/pg4b4
[2] http://www.json.org/javadoc/org/json/JSONTokener.html
[3] http://www.json.org/javadoc/org/json/JSONObject.html
[4] http://www.json.org/javadoc/org/json/JSONArray.html
[5] http://tinyurl.com/mg6zu

#315 From: "Mark Ingalls" <mark_ingalls@...>
Date: Mon Apr 10, 2006 10:32 pm
Subject: RE: Re: json.parse returns false or error with valid strings on server-side JS
marking
Send Email Send Email
 
I don’t see where you are calling fazJSON to stringify the object, but I’ll
assume that objJSN is the stringified version of an object.



I had to wrap the stringified object in a call to encodeURIComponent to get
the object roundtrip successfully.  YMMV



I have a working example that uses two .asp pages and some supporting js
files.  If you’d like them, please let me know and I’ll send them.



Thanks,

Mark



   _____

Original message:

Ok.
I build an object like this on the client side just for testing:
function fazJSON()
{
   var mObj = new Object;
   mObj.Time = new Date().getTime();
   mObj.Data = new Date().toUTCString();
   return JSON.stringify(mObj);
}

Then I pass this object to AJAX.Request (from prototype lib):
new Ajax.Request ('teste.asp',
   {
   method: 'get',
   parameters: 'pedido=' + objJSN,
   onSuccess: procResp,
   onFailure: procErro
   }
);


On the server I get the request using the QueryString, and pass it to
JSON.parse:

strReq = Request.QueryString("pedido");
respObj = JSON.parse(strReq);
if(respObj == false) {
       Response.Write('JSON returned False');
       Response.End;
}

The following are examples of json strings (produced by JSON) that
return false from JSON.parse on the server:
{"Time":1144349903406,"Data":"Thu, 06 Apr 2006 18:58:23 GMT"}
{"Data":"Thu, 06 Apr 2006 19:05:50 GMT"}
{"url":{"hash":"","host":"dnc1","hostname":"dnc1","href":"http://dnc1/evsig2
/teste.html","pathname":"/evsig2/teste.html","port":"","protocol":"http:","s
earch":""}}

But if I eval the strings it's ok.

Also, a last detail. On the server page I use:
<%@ language="javascript"%>
<!--#include virtual="/evsig2/server/json.asp"-->
<%
..rest of the program goes here...
%>

If there's any other info that's relevant just let me know.
Duarte




   _____



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

#316 From: "Douglas Crockford" <douglas@...>
Date: Wed Apr 12, 2006 8:14 pm
Subject: Strict JSON
douglascrock...
Send Email Send Email
 
JSON is primary a set of encoding rules. A JSON encoder is required to
only emit stuff which is strict JSON. The only rule for decoders is
that they accept what an encoder emits. They are free to accept
non-JSON languages if they want to. So a JavaScript engine is a JSON
decoder, or a YAML decoder is also a JSON decoder.

#317 From: "Rafael Faria" <www.rafaelfaria@...>
Date: Wed Apr 12, 2006 9:41 pm
Subject: JSON and special character
rafaelrfc00
Send Email Send Email
 
Hello,

I use to have a lot of application build with ajax, to learn more about JSON
and also implement something easier in one of this applications.

The BIG problem is when i load it, it comes with some kind of different
characters.  I tried with all the ways to set the content type, doc type,
and everything else to try make it works but doesnt.

This file i'm loading that contents json it is a static file, so i can't
escape from some server side than unescape from javascript. I neet to load
the file and it should work.

HOW CAN I DO THAT?! some clue?!

the json content of file is:

[
     {"fase": "", "time1": "Cruzeiro", "placar1": "1", "time2":
"Figueirense", "placar2": "0", "tempo": "", "local": "", "tipojogo":
"detalhado", "xml": ""},
     {"fase": "", "time1": "Goiás", "placar1": "1", "time2": "Vasco",
"placar2": "0", "tempo": "", "local": "", "tipojogo": "detalhado", "xml":
""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""}
]



this "Goiás" is the one that comes with error.

pleaseeeeeeeeeeeeeeeeeeeee someone save me!


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

#318 From: Pavan Kumar Keely <keelypavan@...>
Date: Wed Apr 12, 2006 9:52 pm
Subject: Re: JSON and special character
keelypavan
Send Email Send Email
 
Hi,

   What's the charset ? It seems like you created the file (statis JSON) file
with some local charset. Can you send me that static file ?

   Pavan Keely

Rafael Faria <www.rafaelfaria@...> wrote:
   Hello,

I use to have a lot of application build with ajax, to learn more about JSON
and also implement something easier in one of this applications.

The BIG problem is when i load it, it comes with some kind of different
characters.  I tried with all the ways to set the content type, doc type,
and everything else to try make it works but doesnt.

This file i'm loading that contents json it is a static file, so i can't
escape from some server side than unescape from javascript. I neet to load
the file and it should work.

HOW CAN I DO THAT?! some clue?!

the json content of file is:

[
     {"fase": "", "time1": "Cruzeiro", "placar1": "1", "time2":
"Figueirense", "placar2": "0", "tempo": "", "local": "", "tipojogo":
"detalhado", "xml": ""},
     {"fase": "", "time1": "Goiás", "placar1": "1", "time2": "Vasco",
"placar2": "0", "tempo": "", "local": "", "tipojogo": "detalhado", "xml":
""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""},
     {"fase": "", "time1": "", "placar1": "", "time2": "", "placar2": "",
"tempo": "", "local": "", "tipojogo": "detalhado", "xml": ""}
]



this "Goiás" is the one that comes with error.

pleaseeeeeeeeeeeeeeeeeeeee someone save me!


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



---------------------------------
   YAHOO! GROUPS LINKS


     Visit your group "json" on the web.

     To unsubscribe from this group, send an email to:
  json-unsubscribe@yahoogroups.com

     Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


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





---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

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

#319 From: Stefan Gössner <stefan@...>
Date: Thu Apr 13, 2006 11:05 pm
Subject: JSON support in Atlas
stefangoessner
Send Email Send Email
 
These are interesting news. Microsoft seems to support (de)serializing
objects to/from JSON format.

http://forums.asp.net/thread/1257092.aspx

#320 From: "dnc_octopus" <DCarreira@...>
Date: Fri Apr 14, 2006 11:22 am
Subject: Re: json.parse returns false or error with valid strings on server-side JS
dnc_octopus
Send Email Send Email
 
Mark,

Your assumption is correct.

I'll try encodeURIComponent before using parse and see what happens.

Thanks for your help!
Duarte

--- In json@yahoogroups.com, "Mark Ingalls" <mark_ingalls@...> wrote:
>
> I don't see where you are calling fazJSON to stringify the object,
but I'll
> assume that objJSN is the stringified version of an object.
>
>
>
> I had to wrap the stringified object in a call to encodeURIComponent
to get
> the object roundtrip successfully.  YMMV
>
>
>
> I have a working example that uses two .asp pages and some supporting js
> files.  If you'd like them, please let me know and I'll send them.
>
>
>
> Thanks,
>
> Mark
>
>
>
>   _____
>
> Original message:
>
> Ok.
> I build an object like this on the client side just for testing:
> function fazJSON()
> {
>   var mObj = new Object;
>   mObj.Time = new Date().getTime();
>   mObj.Data = new Date().toUTCString();
>   return JSON.stringify(mObj);
> }
>
> Then I pass this object to AJAX.Request (from prototype lib):
> new Ajax.Request ('teste.asp',
>   {
>   method: 'get',
>   parameters: 'pedido=' + objJSN,
>   onSuccess: procResp,
>   onFailure: procErro
>   }
> );
>
>
> On the server I get the request using the QueryString, and pass it to
> JSON.parse:
>
> strReq = Request.QueryString("pedido");
> respObj = JSON.parse(strReq);
> if(respObj == false) {
>       Response.Write('JSON returned False');
>       Response.End;
> }
>
> The following are examples of json strings (produced by JSON) that
> return false from JSON.parse on the server:
> {"Time":1144349903406,"Data":"Thu, 06 Apr 2006 18:58:23 GMT"}
> {"Data":"Thu, 06 Apr 2006 19:05:50 GMT"}
>
{"url":{"hash":"","host":"dnc1","hostname":"dnc1","href":"http://dnc1/evsig2
>
/teste.html","pathname":"/evsig2/teste.html","port":"","protocol":"http:","s
> earch":""}}
>
> But if I eval the strings it's ok.
>
> Also, a last detail. On the server page I use:
> <%@ language="javascript"%>
> <!--#include virtual="/evsig2/server/json.asp"-->
> <%
> ..rest of the program goes here...
> %>
>
> If there's any other info that's relevant just let me know.
> Duarte
>
>
>
>
>   _____
>
>
>
> [Non-text portions of this message have been removed]
>

#321 From: "Douglas Crockford" <douglas@...>
Date: Sun Apr 16, 2006 2:06 pm
Subject: org.json.simple
douglascrock...
Send Email Send Email
 
Fang Yidong has written a simple JSON package for Java.

http://www.JSON.org/java/json_simple.zip

#322 From: "christopher.stumm" <christopher@...>
Date: Sun Apr 16, 2006 10:03 pm
Subject: JSON.stringify in Safari
christopher....
Send Email Send Email
 
when testing the JSON.stringify function, i noticed that it does not seem to
behave
correctly in safari. The issue is with Objects. It seems to arise from the fact
that
hasOwnProperty does not exist. It means that most Objects will be returned as
null.

I've found a "work around" (not my code), although it has some undesired side
effects:

if(!Object.hasOwnProperty){
     Object.prototype.hasOwnProperty = function(it) {
          return (this[it] && !this.constructor.prototype[it]);
     }
}

I was wondering if anyone else encountered this problem in safari (pre safari
2.0), and if
anyone knew of a work around that didn't have many (if any) side effects.

Thanks.

-Christopher

#323 From: "Mark Nottingham" <mnot@...>
Date: Mon Apr 17, 2006 8:47 pm
Subject: i18n
mnotting
Send Email Send Email
 
Just curious -- what testing has been done of the various libraries and tools
WRT
internationalisation?

I.e., has it been confirmed that i18n works in JSON, and is interoperable?

Cheers,

#324 From: Michal Migurski <mike-jsonphp@...>
Date: Mon Apr 17, 2006 9:59 pm
Subject: Re: i18n
michal_migurski
Send Email Send Email
 
On Apr 17, 2006, at 1:47 PM, Mark Nottingham wrote:

> Just curious -- what testing has been done of the various libraries
> and tools WRT
> internationalisation?
>
> I.e., has it been confirmed that i18n works in JSON, and is
> interoperable?

Well... it assumes Unicode in all strings, if that's what you mean. =)

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

#325 From: "Mark Nottingham" <mnot@...>
Date: Tue Apr 18, 2006 5:16 pm
Subject: Re: i18n
mnotting
Send Email Send Email
 
Yep, I saw that; was just wondering what the gap between specification and
implementation
is...

Cheers,


--- In json@yahoogroups.com, Michal Migurski <mike-jsonphp@...> wrote:
>
> On Apr 17, 2006, at 1:47 PM, Mark Nottingham wrote:
>
> > Just curious -- what testing has been done of the various libraries
> > and tools WRT
> > internationalisation?
> >
> > I.e., has it been confirmed that i18n works in JSON, and is
> > interoperable?
>
> Well... it assumes Unicode in all strings, if that's what you mean. =)

#326 From: "Douglas Crockford" <douglas@...>
Date: Tue Apr 18, 2006 7:23 pm
Subject: Re: i18n
douglascrock...
Send Email Send Email
 
If you should discover a gap in any of the implementations, I hope you
will report it.

Mind the gap.

--- In json@yahoogroups.com, "Mark Nottingham" <mnot@...> wrote:
>
> Yep, I saw that; was just wondering what the gap between
specification and implementation
> is...
>
> Cheers,

#327 From: "zackthom" <zackthom@...>
Date: Tue Apr 18, 2006 7:57 pm
Subject: Re: JSONRequest
zackthom
Send Email Send Email
 
Deos JSON Request allow a true POST today?

I reviewed your docs, and there is some great information here, but you
do not discuss how to do a POST without xmlHtpp.

I am interested in a remote scripting call that allowes me to send
HEADERS.

Is this a proposed new standard or a library implmentation?  How can I
test it?

#328 From: "Lars Goldschlager" <lars.gold@...>
Date: Tue Apr 18, 2006 8:05 pm
Subject: Re: Re: i18n
lars_goldsch...
Send Email Send Email
 
Now that this comes up, a question needs to be asked.

When Unicode chars are specified, is there an inherent encoding scheme
JSON wide? utf-8? utf-16? another schema?

On 4/18/06, Douglas Crockford <douglas@...> wrote:
>  If you should discover a gap in any of the implementations, I hope you
>  will report it.
>
>  Mind the gap.
>
>
>  --- In json@yahoogroups.com, "Mark Nottingham" <mnot@...> wrote:
>  >
>  > Yep, I saw that; was just wondering what the gap between
>  specification and implementation
>  > is...
>  >
>  > Cheers,
>
>
>
>
>
>
>
>
>  ________________________________
>  YAHOO! GROUPS LINKS
>
>
>  Visit your group "json" on the web.
>
>  To unsubscribe from this group, send an email to:
>  json-unsubscribe@yahoogroups.com
>
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>  ________________________________
>

#329 From: "Douglas Crockford" <douglas@...>
Date: Tue Apr 18, 2006 10:53 pm
Subject: Re: i18n
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, "Lars Goldschlager" <lars.gold@...> wrote:
>
> Now that this comes up, a question needs to be asked.
>
> When Unicode chars are specified, is there an inherent encoding
scheme
> JSON wide? utf-8? utf-16? another schema?

You can use any of UTF-8, UTF-16, or UTF-32. I think UTF-8 is the only
thing that makes sense.

See http://www.ietf.org/internet-drafts/draft-crockford-jsonorg-json-
04.txt

#330 From: Fang Yidong <fangyidong@...>
Date: Wed Apr 19, 2006 1:29 am
Subject: Re£º Re: i18n
fangyidong
Send Email Send Email
 
I think UTF-8 is just a transformation format,like GBK
and so on. In the 'internal' of both side (client /
server),unicode is encoded in UCS-2 or UCS-4. I think
support of unicode in JSON refers the latter.

--- Douglas Crockford <douglas@...>:

> --- In json@yahoogroups.com, "Lars Goldschlager"
> <lars.gold@...> wrote:
> >
> > Now that this comes up, a question needs to be
> asked.
> >
> > When Unicode chars are specified, is there an
> inherent encoding
> scheme
> > JSON wide? utf-8? utf-16? another schema?
>
> You can use any of UTF-8, UTF-16, or UTF-32. I think
> UTF-8 is the only
> thing that makes sense.
>
> See
>
http://www.ietf.org/internet-drafts/draft-crockford-jsonorg-json-
> 04.txt
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>     json-unsubscribe@yahoogroups.com
>
>
>
>
>




___________________________________________________________
Ïë³ÉΪ·ëС¸Õ¡¢³Â¿­¸è¡¢ÕżÍÖÐÈý´óµ¼ÑݵÄÖ÷½ÇÂð£¿
http://sostar.cn.yahoo.com

#331 From: "Douglas Crockford" <douglas@...>
Date: Wed Apr 19, 2006 1:07 pm
Subject: Re�� Re: i18n
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, Fang Yidong <fangyidong@...> wrote:
>
> I think UTF-8 is just a transformation format,like GBK
> and so on. In the 'internal' of both side (client /
> server),unicode is encoded in UCS-2 or UCS-4. I think
> support of unicode in JSON refers the latter.

JSON can be used with languages that use 8-bit chars, 16-bit chars, or
32-bit chars. Applications use Unicode in the most convenient size,
which is independent of the wire encoding.

#332 From: "Douglas Crockford" <douglas@...>
Date: Wed Apr 19, 2006 6:54 pm
Subject: Re�� Re: i18n
douglascrock...
Send Email Send Email
 
It is a shame that Yahoo!Groups isn't implemented in JSON. Look at how
the Subject: of this missage got mangled.

#333 From: Fang Yidong <fangyidong@...>
Date: Thu Apr 20, 2006 12:16 am
Subject: Re:Re�� Re: i18n
fangyidong
Send Email Send Email
 
I'm using the GBK version of Yahoo! mail.I forgot to
change 'Re:' in chinese (3 unicode characters) into
english.Maybe it's why the subject looks like this.

--- Douglas Crockford <douglas@...>:

> It is a shame that Yahoo!Groups isn't implemented in
> JSON. Look at how
> the Subject: of this missage got mangled.
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>     json-unsubscribe@yahoogroups.com
>
>
>
>
>







___________________________________________________________
ÑÅ»¢1GÃâ·ÑÓÊÏä°Ù·Ö°Ù·ÀÀ¬»øÐÅ
http://cn.mail.yahoo.com/

#334 From: Blake Seely <blakeseely@...>
Date: Fri Apr 21, 2006 5:26 pm
Subject: non-quoted keys?
blakeseely_99
Send Email Send Email
 
I was just taking a look at the json output from Flickr, and noticed
that they don't quote any of their keys. As I understand it, that's
incorrect - at least based on the specs and info on json.org.

Is that correct? Should I be lobbying them to quote their keys?

(My parser expects quoted keys because I thought that was required by
the spec - if it's not required, I should probably just update my
parser instead of lobbying flickr to quote their keys).

An example output is here:

http://www.flickr.com/services/feeds/photos_public.gne?
id=33248206@N00&format=json

Thanks,
Blake

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

#335 From: Michal Migurski <mike-jsonphp@...>
Date: Fri Apr 21, 2006 5:42 pm
Subject: Re: non-quoted keys?
michal_migurski
Send Email Send Email
 
> I was just taking a look at the json output from Flickr, and noticed
> that they don't quote any of their keys. As I understand it, that's
> incorrect - at least based on the specs and info on json.org.
>
> Is that correct? Should I be lobbying them to quote their keys?

No, they should definitely quote their keys. Parsers can be lenient
in what they accept, but it's lame to produce invalid output like
this, especially when the spec is so tiny.

-mike.

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

#336 From: "Douglas Crockford" <douglas@...>
Date: Fri Apr 21, 2006 8:03 pm
Subject: Introducing JSON
douglascrock...
Send Email Send Email
 
The introduction page of JSON.org is available in Chinese, English,
French, German, Italian, Japanese, and now Korean.

Messages 307 - 336 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