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...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 640 - 669 of 1958   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#640 From: "shalini israni" <shaliny.i@...>
Date: Mon Jan 1, 2007 10:25 am
Subject: Re: Hello everyone!
i_dint_get_t...
Send Email Send Email
 
I faced a similar problem....but i am using Java...
http://www.json.org/javadoc/org/json/XML.html presents a class which is a
part of a downloadable API which has an escape function...
U can see if a similar thing is available for PHP...maybe someone faced a
similar problem... :)

On 12/19/06, canixs <canixs@...> wrote:
>
>   Hello all,
> This is my first post here. I am currently working on a dynamic scripts
> version of my website. I have to say this is my first javascripts using
> json format for the website that I attempt to create. I only familiar
> with php page only. I used php class to convert the xml data to json
> object on fly at the server and send it to client browser.
>
> My question that I have is: What is the proper way to escape the
> special charaters for json data to conform with javascripts character
> rule either at client side or server side, I would prefer server side
> since I like the best experience for visitor. I have sometime ran into
> a couple error where javascript won't
> be able to parse a json data from the server and generate the error due
> to some data string contain invalid character which javascript won't
> like.
>
> I would appreciate any suggestion.
>
> Sincerely,
> KN
>
>
>



--

Shalini


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

#641 From: "Atif Aziz" <atif.aziz@...>
Date: Mon Jan 1, 2007 11:11 pm
Subject: Tidy JSON - Pretty printer/colorer for JSON
azizatif
Send Email Send Email
 
The human-readable aspect of JSON is all well and good in theory, but
turns out to be a mute point in practice. Most JSON producers in the
current web landscape tend to use zero whitespaces or formatting,
favoring (for better or worse) lambda resource savings over human
readability. It does, however, make one's life a bit difficult when
you're trying to get accustomed to some new JSON data, especially while
messing with a live service to get a feel for what it produces and how
it works. To help with my own field work, I succumbed to writing my own
JSON pretty printer and colorer in C# after failing to find one. The
purpose of this message is to simply drop a pointer to the
console/terminal tool in case you've felt my pain and are looking for a
relief:

http://www.raboof.com/projects/tidyjson

Tidy JSON will work on Windows with .NET Framework 2.0 and on Linux
boxes with Mono 1.2. The only glitch with the Linux/Mono combo is that
you don't get coloring if you're feeding JSON over standard input to
tidyjson (send me a mail if you know why and/or how to fix it). You just
get pretty printing. Coloring works fine if the JSON data is stored in a
file. On Windows, it works as advertised.

- Atif

#642 From: Josh Sled <jsled@...>
Date: Tue Jan 2, 2007 4:47 pm
Subject: Re: Tidy JSON - Pretty printer/colorer for JSON
joshsled
Send Email Send Email
 
On Tue, 2007-01-02 at 00:11 +0100, Atif Aziz wrote:
> The human-readable aspect of JSON is all well and good in theory, but
> turns out to be a mute point in practice. Most JSON producers in the
> current web landscape tend to use zero whitespaces or formatting,
> favoring (for better or worse) lambda resource savings over human
> readability. It does, however, make one's life a bit difficult when
> you're trying to get accustomed to some new JSON data, especially
> while
> messing with a live service to get a feel for what it produces and how
> it works. To help with my own field work, I succumbed to writing my
> own
> JSON pretty printer and colorer in C# after failing to find one. The

I did a similar thing; the attached HTML page is a stand-alone (html +
javascript) page which contains a text area into which you can paste
json; on submit it is rendered as a set of nested tables in the page.

--
...jsled
http://asynchronous.org/ - a=jsled;b=asynchronous.org;echo ${a}@${b}


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

#643 From: Josh Sled <jsled@...>
Date: Tue Jan 2, 2007 5:50 pm
Subject: Re: Tidy JSON - Pretty printer/colorer for JSON
joshsled
Send Email Send Email
 
On Tue, 2007-01-02 at 11:47 -0500, Josh Sled wrote:
> I did a similar thing; the attached HTML page is a stand-alone (html +
> javascript) page which contains a text area into which you can paste
> json; on submit it is rendered as a set of nested tables in the page.
[...]
> [Non-text portions of this message have been removed]

Pfft.  Thanks, Yahoo Groups...

http://asynchronous.org/2006/json.html.tar.gz is what I'd attached.
It's archived and compressed in an attempt to disallow the evaluation of
javascript in the context of my domain.

...which makes me realize that I should note that it does interpret the
json via simple eval(...), so don't use it for untrusted json
sources. :)

--
...jsled
http://asynchronous.org/ - a=jsled;b=asynchronous.org;echo ${a}@${b}


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

#644 From: shiju pc <shijupc123@...>
Date: Fri Jan 5, 2007 9:10 am
Subject: About JSON
shijupc123
Send Email Send Email
 
Hi Dear Group Members of Json,

   First of all, I am sending the warm regards to JSON Group members of the New
year.

   And I am a newcomer in JSON groups.

   And dear members of JSON, I have a doubt in JSON.

   Actually I am developer in Java script. On behalf of my work, I heard about
the new JSON, JavaScript Object Notation.

   Actually my real work is that to convert a JSON object file into tree view. So
Dear respected members, can anybody give real idea about the concepts, If so it
will help me well.

   So if anybody get any idea please send the mail to my id
   shijupc123@...
   or
   shijupc@...

   Thankfully
   (SHIJU P.C)






  __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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

#645 From: "Peter Michaux" <petermichaux@...>
Date: Sun Jan 7, 2007 2:15 am
Subject: Re: Re: json date format 2006-12-03T13:56:21
petermichaux
Send Email Send Email
 
On 12/4/06, Peter Michaux <petermichaux@...> wrote:
>
> This is what I was thinking. Milliseconds could be important at times
> and seems unfortunate to throw them out if there is no reason.

Douglas, is there a particular reason for not including milliseconds in json.js?

Thanks,
Peter
--
Fork JavaScript: http://forkjavascript.org

#646 From: "Douglas Crockford" <douglas@...>
Date: Sun Jan 7, 2007 5:23 am
Subject: Re: json date format 2006-12-03T13:56:21
douglascrock...
Send Email Send Email
 
> Douglas, is there a particular reason for not including milliseconds
in json.js?

You have the source, you can put them in any time you want to. But
first, let me ask you a question: How confident that your system's
clock has millisecond accuracy? And that the latency of the OS +
Browser + JavaScript will not cause significant drift by the time it
is delivered to your application? How meaningful will the milliseconds
be when you put them on the wire and send them to your server, whose
clock is not in sync with yours? Milliseconds are a waste of time.

There are applications, such as video editing, where subsecond
accuracy is important. If you have such an application, then you would
want to tack on frames or fractional seconds. If you don't really need
it, then it is better to not deceive yourself with false precision.

#647 From: "Peter Michaux" <petermichaux@...>
Date: Sun Jan 7, 2007 5:40 am
Subject: Re: Re: json date format 2006-12-03T13:56:21
petermichaux
Send Email Send Email
 
On 1/6/07, Douglas Crockford <douglas@...> wrote:
>
> > Douglas, is there a particular reason for not including milliseconds
>  in json.js?
>
>  You have the source, you can put them in any time you want to. But
>  first, let me ask you a question: How confident that your system's
>  clock has millisecond accuracy? And that the latency of the OS +
>  Browser + JavaScript will not cause significant drift by the time it
>  is delivered to your application? How meaningful will the milliseconds
>  be when you put them on the wire and send them to your server, whose
>  clock is not in sync with yours? Milliseconds are a waste of time.

I'm sorry for bothering you, sir. Thank you for your answer. I'll go
back to my corner now.

Peter

#648 From: "shalini israni" <shaliny.i@...>
Date: Mon Jan 8, 2007 3:48 am
Subject: Re: About JSON
i_dint_get_t...
Send Email Send Email
 
Hi,
Happy new year to u too...
Could u explain what ur problem in finer detail?
Until then u could look at http://www.json.org/

Regards

On 1/5/07, shiju pc <shijupc123@...> wrote:
>
>    Hi Dear Group Members of Json,
>
> First of all, I am sending the warm regards to JSON Group members of the
> New year.
>
> And I am a newcomer in JSON groups.
>
> And dear members of JSON, I have a doubt in JSON.
>
> Actually I am developer in Java script. On behalf of my work, I heard
> about the new JSON, JavaScript Object Notation.
>
> Actually my real work is that to convert a JSON object file into tree
> view. So Dear respected members, can anybody give real idea about the
> concepts, If so it will help me well.
>
> So if anybody get any idea please send the mail to my id
> shijupc123@... <shijupc123%40yahoo.com>
> or
> shijupc@... <shijupc%40gmail.com>
>
> Thankfully
> (SHIJU P.C)
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> [Non-text portions of this message have been removed]
>
>
>



--

Shalini


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

#649 From: "shalini israni" <shaliny.i@...>
Date: Tue Jan 9, 2007 10:22 am
Subject: Re: About JSON
i_dint_get_t...
Send Email Send Email
 
hmmnnn...I'm sorry i'm not aware of JSON files... i'll let u know if i hit
upon anything...

On 1/8/07, shiju pc <shijupc@...> wrote:
>
> Hi...
>
>
>
>
>
>       Thank you for your best consideration in least time. And actually I
> am doing my work in Json. As a part of my work what I want to do is to
> create a tree dynamically by reading a json file .ie.First of all I want to
> parse a json file and read the objects from that file, but one object may
> contain nested objects and that may contain many of that kind.
>
>
>  Finally object contains key value pairs. The object want to be
> interpreted as expandable tree nodes and key value pairs want to be
> interpreted as no expandable nodes. This is what I want to get. I hope the
> problem is clear if any further clarification needed please ask.
>
>                                                              Thankfully
>                                                              (SHIJU P.C)
>



--

Shalini


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

#650 From: "Douglas Crockford" <douglas@...>
Date: Wed Jan 10, 2007 7:25 pm
Subject: parseJSON
douglascrock...
Send Email Send Email
 
The parseJSON method currently takes a filter function parameter. It
will be invoked for every name/value in the structure.
myData = text.parseJSON(function (key, value) {         return
key.indexOf('date') >= 0 ? new Date(value) : value;     });
The filtration mechanism is just a general purpose map function. It
could be exposed as a separate method and used independently. If we were
to do that, then it could be used like this:
myData = text.parseJSON().filter(function (key, value) {         return
key.indexOf('date') >= 0 ? new Date(value) : value;     });
Do you think a general purpose .filter method is useful? Should it be
added to ECMAScript?



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

#651 From: "Michael Schwarz" <michael.schwarz@...>
Date: Wed Jan 10, 2007 8:26 pm
Subject: Re: parseJSON
schwarz_inte...
Send Email Send Email
 
Hi Douglas,

as I can remember you wrote some weeks ago that parseJSON will be
added, too, I would say yes, and I like the filter method more than
using parameter.

Michael


On 1/10/07, Douglas Crockford <douglas@...> wrote:
>
> The parseJSON method currently takes a filter function parameter. It
> will be invoked for every name/value in the structure.
> myData = text.parseJSON(function (key, value) {         return
> key.indexOf('date') >= 0 ? new Date(value) : value;     });
> The filtration mechanism is just a general purpose map function. It
> could be exposed as a separate method and used independently. If we were
> to do that, then it could be used like this:
> myData = text.parseJSON().filter(function (key, value) {         return
> key.indexOf('date') >= 0 ? new Date(value) : value;     });
> Do you think a general purpose .filter method is useful? Should it be
> added to ECMAScript?
>
>
>
> [Non-text portions of this message have been removed]
>
>
>


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

WPF/E: http://groups.google.com/group/wpf-everywhere

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

#652 From: "Peter Michaux" <petermichaux@...>
Date: Wed Jan 10, 2007 8:54 pm
Subject: Re: parseJSON
petermichaux
Send Email Send Email
 
On 1/10/07, Douglas Crockford <douglas@...> wrote:
>  The parseJSON method currently takes a filter function parameter. It
>  will be invoked for every name/value in the structure.
>  myData = text.parseJSON(function (key, value) {         return
>  key.indexOf('date') >= 0 ? new Date(value) : value;     });
>  The filtration mechanism is just a general purpose map function. It
>  could be exposed as a separate method and used independently. If we were
>  to do that, then it could be used like this:
>  myData = text.parseJSON().filter(function (key, value) {         return
>  key.indexOf('date') >= 0 ? new Date(value) : value;     });
>  Do you think a general purpose .filter method is useful? Should it be
>  added to ECMAScript?

Would this general purpose filter as a property of Object.prototype be
instead of or in addition to the argument to parseJSON?

Could filter take a second parameter to specify if it is "deep" filter
or not? That is, whether or not it will descend through the structure
or only operate on  the top level.

It looks like the general purpose version is not harder to use and
could be useful in many situations (i did something just like it
recently to clean up empty nodes in a structure). It has the feel of
Enumerable.each() in the Prototype library. If this filter is added to
JavaScript perhaps some of the other Ruby enumerable, array and hash
functions could be considered for addition.

Peter

#653 From: "Peter Michaux" <petermichaux@...>
Date: Wed Jan 10, 2007 10:55 pm
Subject: Re: parseJSON
petermichaux
Send Email Send Email
 
On 1/10/07, Douglas Crockford <douglas@...> wrote:
>
>  The parseJSON method currently takes a filter function parameter. It
>  will be invoked for every name/value in the structure.
>  myData = text.parseJSON(function (key, value) {         return
>  key.indexOf('date') >= 0 ? new Date(value) : value;     });
>  The filtration mechanism is just a general purpose map function. It
>  could be exposed as a separate method and used independently. If we were
>  to do that, then it could be used like this:
>  myData = text.parseJSON().filter(function (key, value) {         return
>  key.indexOf('date') >= 0 ? new Date(value) : value;     });
>  Do you think a general purpose .filter method is useful? Should it be
>  added to ECMAScript?


Calling it "filter" may cause a namespace problem?

<URL:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array\
:filter>

Peter

#654 From: "Peter Michaux" <petermichaux@...>
Date: Thu Jan 11, 2007 7:13 am
Subject: Re: Re: json date format 2006-12-03T13:56:21
petermichaux
Send Email Send Email
 
On 1/6/07, Douglas Crockford <douglas@...> wrote:
>
> > Douglas, is there a particular reason for not including milliseconds
>  in json.js?
>
>  You have the source, you can put them in any time you want to. But
>  first, let me ask you a question: How confident that your system's
>  clock has millisecond accuracy? And that the latency of the OS +
>  Browser + JavaScript will not cause significant drift by the time it
>  is delivered to your application? How meaningful will the milliseconds
>  be when you put them on the wire and send them to your server, whose
>  clock is not in sync with yours? Milliseconds are a waste of time.

A date object is not necessarily constructed with no arguments sent to
the Date constructor. It could very well be that in some applications
the construction of the Date object could use date data from a user
input which has very accurate and critical milliseconds information
from another very accurate system.

Peter

#655 From: "Michael Schwarz" <michael.schwarz@...>
Date: Thu Jan 11, 2007 2:05 pm
Subject: Re: parseJSON
schwarz_inte...
Send Email Send Email
 
It looks like the LINQ features in C# 3.0:
http://tirania.org/blog/archive/2007/Jan-10.html

;)




On 1/10/07, Douglas Crockford <douglas@...> wrote:
>
>
>
>
>
>
>
> The parseJSON method currently takes a filter function parameter. It
> will be invoked for every name/value in the structure.
> myData = text.parseJSON(function (key, value) { return
> key.indexOf('date') >= 0 ? new Date(value) : value; });
> The filtration mechanism is just a general purpose map function. It
> could be exposed as a separate method and used independently. If we were
> to do that, then it could be used like this:
> myData = text.parseJSON().filter(function (key, value) { return
> key.indexOf('date') >= 0 ? new Date(value) : value; });
> Do you think a general purpose .filter method is useful? Should it be
> added to ECMAScript?
>
> [Non-text portions of this message have been removed]
>
>



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

WPF/E: http://groups.google.com/group/wpf-everywhere

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

#656 From: "geoffreyk00" <geoffreyk@...>
Date: Thu Jan 11, 2007 3:32 pm
Subject: Re: json date format 2006-12-03T13:56:21
geoffreyk00
Send Email Send Email
 
--- In json@yahoogroups.com, "Peter Michaux" <petermichaux@...>
wrote:
>
> On 1/6/07, Douglas Crockford <douglas@...> wrote:
> >
> > > Douglas, is there a particular reason for not including
milliseconds
> >  in json.js?
> >
> >  You have the source, you can put them in any time you want to.
But
> >  first, let me ask you a question: How confident that your
system's
> >  clock has millisecond accuracy? And that the latency of the OS +
> >  Browser + JavaScript will not cause significant drift by the
time it
> >  is delivered to your application? How meaningful will the
milliseconds
> >  be when you put them on the wire and send them to your server,
whose
> >  clock is not in sync with yours? Milliseconds are a waste of
time.
>
> A date object is not necessarily constructed with no arguments
sent to
> the Date constructor. It could very well be that in some
applications
> the construction of the Date object could use date data from a user
> input which has very accurate and critical milliseconds information
> from another very accurate system.
>
> Peter
>

The date object may be historical data that truly is millisecond-
accurate. The object does not have to be constructed when the
dataset is created or by the server that is delivering the dataset.
I more likely will have been created long before, with many date
objects that do need this level of accuracy.

I can see no reason to not to include milliseconds, and many reasons
to keep them.

#657 From: "ljmiller8649" <ljmiller8649@...>
Date: Thu Jan 11, 2007 3:46 pm
Subject: Hello - question on JSON data types
ljmiller8649
Send Email Send Email
 
I'm new to JSON and want to format a number (e.g., 73.50) as a
financial number. The "float" data type treats the number as 73.5 and
drops the trailing zero. My declaration is:

    {"title":"$Sales","dataType":"float", "columnWidth":"80"} ... etc.
    with
    {"v":73.50} ... as the incoming data

I've heard about ways to extend the base data types but this is
probably beyond my current abilities - and I'm looking for the
simplest answers. Is there an easy way to handle this without too many
extensions of the base data types ? Since the end-goal is financial
data, is here a way to build a currency symbol into the data type ?

thanks in advance for any help.

regards,
Lance

#658 From: "Peter Michaux" <petermichaux@...>
Date: Thu Jan 11, 2007 10:25 pm
Subject: JSON regular expression fails to recognize JSON in Netscape <= 7.1
petermichaux
Send Email Send Email
 
Hi,

I just did some tests in some version of Netscape Navigator. The
following fails in version <= 7.1 because the regular expression can't
match the double quotes around the letter 'a' in the json string being
compared to the regular expression. Both NN7.2 and Firefox 1.0 both
return true for this test.

/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test('{"a":3}')

NN6 is capable of all the other JavaScript I am using (Ajax, Dom
manipulation, Events) and it seems ashame this regular expression is
the single part of the JSON library that requires such a new browser.
Would there be a way to write this regular expression so it works as
far back as NN6 or at least farther back than NN7.2? If not what is it
in the regular expression that is failing to recognize this simple
JSON string?

Thank you,
Peter

#659 From: "Douglas Crockford" <douglas@...>
Date: Thu Jan 11, 2007 10:36 pm
Subject: Re: Hello - question on JSON data types
douglascrock...
Send Email Send Email
 
> I'm new to JSON and want to format a number (e.g., 73.50) as a
> financial number. The "float" data type treats the number as 73.5 and
> drops the trailing zero.

This isn't a JSON question. It is a JavaScript question.

     n.toFixed(2)

#660 From: "Douglas Crockford" <douglas@...>
Date: Thu Jan 11, 2007 10:47 pm
Subject: Re: JSON regular expression fails to recognize JSON in Netscape <= 7.1
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, "Peter Michaux" <petermichaux@...> wrote:
>
> Hi,
>
> I just did some tests in some version of Netscape Navigator. The
> following fails in version <= 7.1 because the regular expression can't
> match the double quotes around the letter 'a' in the json string being
> compared to the regular expression. Both NN7.2 and Firefox 1.0 both
> return true for this test.
>
> /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u
\n\r\t])+?$/.test('{"a":3}')
>
> NN6 is capable of all the other JavaScript I am using (Ajax, Dom
> manipulation, Events) and it seems ashame this regular expression is
> the single part of the JSON library that requires such a new browser.
> Would there be a way to write this regular expression so it works as
> far back as NN6 or at least farther back than NN7.2? If not what is it
> in the regular expression that is failing to recognize this simple
> JSON string?

I don't know what was wrong with NN6. If I were to guess, it would be
that it did not support the lazy quantifiers, *? and +?. If you
replaced them with the greedy quantifiers, * and +, it might work.

But there is a bug in IE6 in which the greedy quantifiers cause the
regexp to run in exponential time. When the text gets big, IE gets
really really slow.

#661 From: "Mark Ireland" <markincuba@...>
Date: Fri Jan 12, 2007 5:23 am
Subject: adobe spry
akaidr4vr
Send Email Send Email
 
Are people on this list checking out Adobes Spry?

(I ask because it seems to use json.data.recordSets)

_________________________________________________________________
Advertisement: Fresh jobs daily. Stop waiting for the newspaper. Search Now!
www.seek.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t=757\
263760&_r=Hotmail_EndText_Dec06&_m=EXT

#662 From: mark <rkmr.em@...>
Date: Tue Jan 16, 2007 1:00 am
Subject: json object from cookie
cosmic_civilian
Send Email Send Email
 
I am trying to get JSON object from a JSON string in a cookie. When I
convert the string read from cookie, i still get a string and  not a JSON
object. So i did an eval on the string again and I get the JSON object fine.
is this the right way to do this?
what am i doing wrong?

thanks
mark


here is what i do:
var json_text=getcookie('sub_options');
var json_text_string = eval('(' + json_text + ')');
var options_list= eval('(' + json_text_string + ')');

//to get cookie
function getcookie(cookiename) {
var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename);
if (index1==-1 || cookiename=="") return "";
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length;
return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}


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

#663 From: "Mark Ireland" <markincuba@...>
Date: Tue Jan 16, 2007 5:00 am
Subject: RE: json object from cookie
akaidr4vr
Send Email Send Email
 
What test do you do to show that your string is not a JSON object?


>From: mark <rkmr.em@...>
>Reply-To: json@yahoogroups.com
>To: json@yahoogroups.com
>Subject: [json] json object from cookie
>Date: Mon, 15 Jan 2007 17:00:31 -0800
>
>I am trying to get JSON object from a JSON string in a cookie. When I
>convert the string read from cookie, i still get a string and  not a JSON
>object. So i did an eval on the string again and I get the JSON object
>fine.
>is this the right way to do this?
>what am i doing wrong?
>
>thanks
>mark
>
>
>here is what i do:
>var json_text=getcookie('sub_options');
>var json_text_string = eval('(' + json_text + ')');
>var options_list= eval('(' + json_text_string + ')');
>
>//to get cookie
>function getcookie(cookiename) {
>var cookiestring=""+document.cookie;
>var index1=cookiestring.indexOf(cookiename);
>if (index1==-1 || cookiename=="") return "";
>var index2=cookiestring.indexOf(';',index1);
>if (index2==-1) index2=cookiestring.length;
>return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
>}
>
>
>[Non-text portions of this message have been removed]
>

_________________________________________________________________
Advertisement: Meet Sexy Singles Today @ Lavalife - Click here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2\
Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%\
26a%3D23769&_t=754951090&_r=endtext_lavalife_dec_meet&_m=EXT

#664 From: mark <rkmr.em@...>
Date: Tue Jan 16, 2007 5:37 am
Subject: Re: json object from cookie
cosmic_civilian
Send Email Send Email
 
i did :
alert(typeof(json_text_string))


i got string as the type.
and after i did an eval again i did this again for which i got the type as
"object".
mark
On 1/15/07, Mark Ireland <markincuba@...> wrote:
>
>
> What test do you do to show that your string is not a JSON object?
>
> >From: mark <rkmr.em@... <rkmr.em%40gmail.com>>
> >Reply-To: json@yahoogroups.com <json%40yahoogroups.com>
> >To: json@yahoogroups.com <json%40yahoogroups.com>
> >Subject: [json] json object from cookie
> >Date: Mon, 15 Jan 2007 17:00:31 -0800
> >
> >I am trying to get JSON object from a JSON string in a cookie. When I
> >convert the string read from cookie, i still get a string and not a JSON
> >object. So i did an eval on the string again and I get the JSON object
> >fine.
> >is this the right way to do this?
> >what am i doing wrong?
> >
> >thanks
> >mark
> >
> >
> >here is what i do:
> >var json_text=getcookie('sub_options');
> >var json_text_string = eval('(' + json_text + ')');
> >var options_list= eval('(' + json_text_string + ')');
> >
> >//to get cookie
> >function getcookie(cookiename) {
> >var cookiestring=""+document.cookie;
> >var index1=cookiestring.indexOf(cookiename);
> >if (index1==-1 || cookiename=="") return "";
> >var index2=cookiestring.indexOf(';',index1);
> >if (index2==-1) index2=cookiestring.length;
> >return unescape(cookiestring.substring
> (index1+cookiename.length+1,index2));
> >}
> >
> >
> >[Non-text portions of this message have been removed]
> >
>
> __________________________________________________________
> Advertisement: Meet Sexy Singles Today @ Lavalife - Click here
>
>
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2\
Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%\
26a%3D23769&_t=754951090&_r=endtext_lavalife_dec_meet&_m=EXT
>
>
>


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

#665 From: Prathapnirmal <prathapnirmal@...>
Date: Tue Jan 16, 2007 8:30 am
Subject: Re: json object from cookie
pradhapnirmal
Send Email Send Email
 
can we see the cookie string that you are trying to set?

On 1/16/07, mark <rkmr.em@...> wrote:
>
>   i did :
> alert(typeof(json_text_string))
>
> i got string as the type.
> and after i did an eval again i did this again for which i got the type as
> "object".
> mark
> On 1/15/07, Mark Ireland <markincuba@...<markincuba%40hotmail.com>>
> wrote:
> >
> >
> > What test do you do to show that your string is not a JSON object?
> >
> > >From: mark <rkmr.em@... <rkmr.em%40gmail.com> <
> rkmr.em%40gmail.com>>
> > >Reply-To: json@yahoogroups.com
<json%40yahoogroups.com><json%40yahoogroups.com>
> > >To: json@yahoogroups.com <json%40yahoogroups.com><json%40yahoogroups.com>
>
> > >Subject: [json] json object from cookie
> > >Date: Mon, 15 Jan 2007 17:00:31 -0800
> > >
> > >I am trying to get JSON object from a JSON string in a cookie. When I
> > >convert the string read from cookie, i still get a string and not a
> JSON
> > >object. So i did an eval on the string again and I get the JSON object
> > >fine.
> > >is this the right way to do this?
> > >what am i doing wrong?
> > >
> > >thanks
> > >mark
> > >
> > >
> > >here is what i do:
> > >var json_text=getcookie('sub_options');
> > >var json_text_string = eval('(' + json_text + ')');
> > >var options_list= eval('(' + json_text_string + ')');
> > >
> > >//to get cookie
> > >function getcookie(cookiename) {
> > >var cookiestring=""+document.cookie;
> > >var index1=cookiestring.indexOf(cookiename);
> > >if (index1==-1 || cookiename=="") return "";
> > >var index2=cookiestring.indexOf(';',index1);
> > >if (index2==-1) index2=cookiestring.length;
> > >return unescape(cookiestring.substring
> > (index1+cookiename.length+1,index2));
> > >}
> > >
> > >
> > >[Non-text portions of this message have been removed]
> > >
> >
> > __________________________________________________________
> > Advertisement: Meet Sexy Singles Today @ Lavalife - Click here
> >
> >
>
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2\
Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%\
26a%3D23769&_t=754951090&_r=endtext_lavalife_dec_meet&_m=EXT
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>
>



--
Web Applications Engineer
Google Online India Pvt. Ltd.
7th Floor, Jayabheri Silicon Towers,
Madhapur Road, Kondapur
Hyderabad - 500 032
mobile : +91 99856 34636


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

#666 From: "Douglas Crockford" <douglas@...>
Date: Tue Jan 16, 2007 2:04 pm
Subject: Re: json object from cookie
douglascrock...
Send Email Send Email
 
> I am trying to get JSON object from a JSON string in a cookie. When I
> convert the string read from cookie, i still get a string and  not a
JSON
> object. So i did an eval on the string again and I get the JSON
object fine.
> is this the right way to do this?

An example of the use of JSON cookies can be found at
http://www.JSLint.com/index.html

#667 From: "genzoeri" <genzoeri@...>
Date: Tue Jan 16, 2007 2:59 pm
Subject: JSON vs XML
genzoeri
Send Email Send Email
 
Hii, I am newbie with json. after I read article in
http://www.developer.com/lang/jscript/article.php/10939_3596836_2, I
know that json is faster than xml. I want to know if anybody have the
testing script or algorithm how to prove this issue?
Regards,
Genzoeri.

#668 From: Crzy4c <Crzy4c@...>
Date: Tue Jan 16, 2007 4:51 pm
Subject: Re: Re: json object from cookie
crzy4c
Send Email Send Email
 
Why not simply use the parseJSON function?

var myObject = myJSONtext.parseJSON(filter);

(see : http://www.json.org/js.html for more detailed example and
explaination)

Mike



On 1/16/07, Douglas Crockford <douglas@...> wrote:
>
>   > I am trying to get JSON object from a JSON string in a cookie. When I
> > convert the string read from cookie, i still get a string and not a
> JSON
> > object. So i did an eval on the string again and I get the JSON
> object fine.
> > is this the right way to do this?
>
> An example of the use of JSON cookies can be found at
> http://www.JSLint.com/index.html <http://www.jslint.com/index.html>
>
>
>


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

#669 From: "Mark Ireland" <markincuba@...>
Date: Tue Jan 16, 2007 10:01 pm
Subject: Re: json object from cookie
akaidr4vr
Send Email Send Email
 
Can we see the string?


>From: mark <rkmr.em@...>
>Reply-To: json@yahoogroups.com
>To: json@yahoogroups.com
>Subject: Re: [json] json object from cookie
>Date: Mon, 15 Jan 2007 21:37:34 -0800
>
>i did :
>alert(typeof(json_text_string))
>
>
>i got string as the type.
>and after i did an eval again i did this again for which i got the type as
>"object".
>mark
>On 1/15/07, Mark Ireland <markincuba@...> wrote:
> >
> >
> > What test do you do to show that your string is not a JSON object?
> >
> > >From: mark <rkmr.em@... <rkmr.em%40gmail.com>>
> > >Reply-To: json@yahoogroups.com <json%40yahoogroups.com>
> > >To: json@yahoogroups.com <json%40yahoogroups.com>
> > >Subject: [json] json object from cookie
> > >Date: Mon, 15 Jan 2007 17:00:31 -0800
> > >
> > >I am trying to get JSON object from a JSON string in a cookie. When I
> > >convert the string read from cookie, i still get a string and not a
>JSON
> > >object. So i did an eval on the string again and I get the JSON object
> > >fine.
> > >is this the right way to do this?
> > >what am i doing wrong?
> > >
> > >thanks
> > >mark
> > >
> > >
> > >here is what i do:
> > >var json_text=getcookie('sub_options');
> > >var json_text_string = eval('(' + json_text + ')');
> > >var options_list= eval('(' + json_text_string + ')');
> > >
> > >//to get cookie
> > >function getcookie(cookiename) {
> > >var cookiestring=""+document.cookie;
> > >var index1=cookiestring.indexOf(cookiename);
> > >if (index1==-1 || cookiename=="") return "";
> > >var index2=cookiestring.indexOf(';',index1);
> > >if (index2==-1) index2=cookiestring.length;
> > >return unescape(cookiestring.substring
> > (index1+cookiename.length+1,index2));
> > >}
> > >
> > >
> > >[Non-text portions of this message have been removed]
> > >
> >
> > __________________________________________________________
> > Advertisement: Meet Sexy Singles Today @ Lavalife - Click here
> >
> >
>http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%\
2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU\
%26a%3D23769&_t=754951090&_r=endtext_lavalife_dec_meet&_m=EXT
> >
> >
> >
>
>
>[Non-text portions of this message have been removed]
>

_________________________________________________________________
Advertisement: It's simple! Sell your car for just $20 at carsales.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%5F801577%2Fpi%5F1005244%2Fai%5F8385\
88&_t=757768878&_r=endtext_simple&_m=EXT

Messages 640 - 669 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