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 630 - 659 of 1953   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#630 From: "Matthew Morley" <WickedLogic@...>
Date: Mon Dec 18, 2006 3:10 am
Subject: Re: json as js variable
mpcmtechnolo...
Send Email Send Email
 
Why not return an object w/ 2 properties.

One being an array containing field names, the other being an array of
arrays, representing data records (that match the field layout).

Or the second object setup with properties named after the u80020, but still
being just an array of fields in that object.

--
Matthew P. C. Morley
MPCM Technologies Inc.


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

#631 From: "Mark Ireland" <markincuba@...>
Date: Mon Dec 18, 2006 4:00 am
Subject: Re: json as js variable
akaidr4vr
Send Email Send Email
 
How would you use dot notation in each case?

>From: "Matthew Morley" <WickedLogic@...>
>Reply-To: json@yahoogroups.com
>To: json@yahoogroups.com
>Subject: Re: [json] json as js variable
>Date: Sun, 17 Dec 2006 22:10:06 -0500
>
>Why not return an object w/ 2 properties.
>
>One being an array containing field names, the other being an array of
>arrays, representing data records (that match the field layout).
>
>Or the second object setup with properties named after the u80020, but
>still
>being just an array of fields in that object.
>
>--
>Matthew P. C. Morley
>MPCM Technologies Inc.
>
>
>[Non-text portions of this message have been removed]
>

_________________________________________________________________
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

#632 From: "Matthew Morley" <WickedLogic@...>
Date: Mon Dec 18, 2006 11:50 am
Subject: Re: json as js variable
mpcmtechnolo...
Send Email Send Email
 
You would have to do something more than a simple translation.

If your end goal was to directly reference fields values by name, you would
need to do an end translation back to the object format in which you were
trying to avoid by duplicating names. Just a loop to recreate the data
object from the two arrays.

You have the knowledge of the fields names and could do your looping in
another manner, without direct reference anyway. Depends how exposed it is I
suppose and what level of work you want consumers of the data to do/know. I
found gzip an easier alternative than object rebuilding when looking at
performance in my projects

Depending on the size of your data and lots of other items, it is likely to
be faster for transmitting due to reduced payload, but it requires you to
deal with the arrays and not objects unless you rebuild them.

var row = MyStuff.u80020;
var field_ISWEATHER = 3;
var val = MyStuff.u80020[field_ISWEATHER];

--
Matthew P. C. Morley
MPCM Technologies Inc.


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

#633 From: "Douglas Crockford" <douglas@...>
Date: Tue Dec 19, 2006 4:39 am
Subject: python-cjson
douglascrock...
Send Email Send Email
 
There is a new implementation for Python:
http://cheeseshop.python.org/pypi/python-cjson

#634 From: "Mark Ireland" <markincuba@...>
Date: Tue Dec 19, 2006 5:24 am
Subject: Re: json as js variable
akaidr4vr
Send Email Send Email
 
Hopefully I can clear all this up. First I wanted to save on whitespace by
avoiding
var myArray = new Array;
cfloop
var myArray[myIndex] = new Array;
myArray[myIndex]['mycolumnName1']=#myQuery.myColumn1#;
myArray[myIndex]['mycolumnName2']=#myQuery.myColumn2#;
etc
/cfloop

Then I thought I could dynamically name form elements and get stuff from a
js object that I could reference with dot notation. (with myIndex as the id
of the element) Most of the stuff in the object is just flags that determine
how the page behaves.

If my goal is the shrink the page size what is the better approach?

Thanks


>From: "Matthew Morley" <WickedLogic@...>
>Reply-To: json@yahoogroups.com
>To: json@yahoogroups.com
>Subject: Re: [json] json as js variable
>Date: Mon, 18 Dec 2006 06:50:37 -0500
>
>You would have to do something more than a simple translation.
>
>If your end goal was to directly reference fields values by name, you would
>need to do an end translation back to the object format in which you were
>trying to avoid by duplicating names. Just a loop to recreate the data
>object from the two arrays.
>
>You have the knowledge of the fields names and could do your looping in
>another manner, without direct reference anyway. Depends how exposed it is
>I
>suppose and what level of work you want consumers of the data to do/know. I
>found gzip an easier alternative than object rebuilding when looking at
>performance in my projects
>
>Depending on the size of your data and lots of other items, it is likely to
>be faster for transmitting due to reduced payload, but it requires you to
>deal with the arrays and not objects unless you rebuild them.
>
>var row = MyStuff.u80020;
>var field_ISWEATHER = 3;
>var val = MyStuff.u80020[field_ISWEATHER];
>
>--
>Matthew P. C. Morley
>MPCM Technologies Inc.
>
>
>[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

#635 From: "Kazuho Oku" <kazuhooku@...>
Date: Tue Dec 19, 2006 5:26 am
Subject: JSON Compatibility Issues
kazuho_oku
Send Email Send Email
 
Subject: JSON Compatibility Issues

Hi,

While I was debugging my web application, I found following
compatibility issues regarding JSON and major web browsers.


1) ECMAScript conformance of RFC 4627 (JSON RFC)

According to Section 7.3 and 7.8.4 of ECMA-262 3rd Edition, U+2028 nor
U+2029 are permitted within string literals, but RFC 4627 does not
state as such in Section 2.5.  I think this issue should be fixed so
that JSON would be compatible with ECMAScript.


2) Browser implementation issues regarding string literals

Most web browsers seem to require yet more characters to be escaped
within string literals.

According to my test, IE 6 and 7, and Safari 2.0.4 fails to parse NUL
characters (without being escaped) within string literals.  Firefox
1.5 and 2.0 silently drops following characters within string literals
if not escaped: U+200C-U+200F, U+202A-U+202E, U+206A-U+206F, U+FEFF.
Opera 9 seems to be the only browser comformant to the ECMA
specification.  Test code is attached below.

Although this is not a problem of the JSON specification, I think it
would be helpful for developers if the specification recommended using
escape sequences for the above characters as well.

Thank you.



// test code for finding characters that should be escaped
var a = [];
for (var i = 0; i < 65536; i++) {
   var s = '';
   try {
     eval('s = "' + String.fromCharCode(i) + '"');
   } catch (e) {
   }
   if (s.length != 1) {
     a.push(i.toString(16));
   }
}
alert(a.join(' '));

#636 From: "Matthew Morley" <WickedLogic@...>
Date: Tue Dec 19, 2006 12:32 pm
Subject: Re: json as js variable
mpcmtechnolo...
Send Email Send Email
 
It would depend on what you mean by page and how much data you are dealing
with. 3-10kb range might not make a huge difference on download, 20-300kb
might. Run some tests and time them in js, just keep in mind that they will
vary from machine to machine greatly. I keep a 433mhz celeron laptop around
to make sure I don't lose sight of performance too much.

If you are worried about transmission speed and you have a fairly big set of
data going, consider sizing it down. I know it sounds simple, but the
fastest way to speed up anything is to do less; less data, less parsing.
Don't optimize and worry about speed until you can prove it is running
slowly and that the program is only `thinking` as much as it needs to.

If that is not possible or desired, look at compressing the output with
something like gzip if the browser supports it, but the numbers all get down
to your data set. Using objects vs an object with an array of results and an
array of keys is just a matter for the code/coder. Depends who your consumer
is. If you want an object, send an object, and compress the communication
would be my stance.

Are you generating raw js right into the initial page? If yes, consider
moving it out into a separate request. That way you can do initial loads and
refresh with the data as it becomes available.

--
Matthew P. C. Morley
MPCM Technologies Inc.


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

#637 From: "Atif Aziz" <atif.aziz@...>
Date: Tue Dec 19, 2006 1:30 pm
Subject: RE: json as js variable
azizatif
Send Email Send Email
 
I think I know what you're looking for here. Suppose the following
table:

var table = {
   "columns" : [ "FirstName", "LastName" ],
   "rows" : [
     [ "Mickey", "Mouse" ],
     [ "Donald", "Duck" ],
     [ "Minnie", "Mouse" ]
   ]
};

Suppose further a function we add to the Array object's prototype:

Array.prototype.toObject = function(names)
{
     var o = {};
     for (var i = 0; i < names.length; i++)
         o[names[i]] = i < this.length ? this[i] : null;

     return o;
}

Now you can conveniently convert any row of the table into an object in
one swell swoop like this:

var o = table.rows[1].toObject(table.columns);

This gives you non-repeating column names in the original table
definition in JSON, which may be useful to keep the data on the wire
small, yet object-like access (dot-syntax) to a row once in script.

Hope this help.

-----Original Message-----
From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
Mark Ireland
Sent: Sunday, December 17, 2006 11:19 PM
To: json@yahoogroups.com
Subject: Re: [json] json as js variable


Thanks, that got it working.

Now I am wondering if there is some alternative to repeating the column
names in every object.

>From: "Matthew Morley" <WickedLogic@...
<mailto:WickedLogic%40gmail.com> >
>Reply-To: json@yahoogroups.com <mailto:json%40yahoogroups.com>
>To: json@yahoogroups.com <mailto:json%40yahoogroups.com>
>Subject: Re: [json] json as js variable
>Date: Mon, 11 Dec 2006 06:41:03 -0500
>
>*Identifiers* are names for constants, variables, functions, loop
labels,
>objects and classes. The first character must be an ASCII letter,
>underscore
>or dollar sign. Following characters can also include digits.
>
>Even 'u80020' will do. You can only use numeric indexes if you are
>producing
>an array.
>
>--
>Matthew P. C. Morley
>
>
>[Non-text portions of this message have been removed]
>

__________________________________________________________
Join the millions of Australians using Live Search. Try live.com.au
http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=740&re
ferral=million&URL=http://live.com.au
<http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=740&r
eferral=million&URL=http://live.com.au>

#638 From: "canixs" <canixs@...>
Date: Tue Dec 19, 2006 3:53 pm
Subject: Hello everyone!
canixs
Send Email Send Email
 
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

#639 From: "Mark Ireland" <markincuba@...>
Date: Thu Dec 21, 2006 12:14 am
Subject: RE: json as js variable
akaidr4vr
Send Email Send Email
 
This is the right general idea but . . ...

I am thinking:
var myJSObject =
{"RECORDCOUNT":3,"UNIQUEIDS":["js73012","js73016","js73029"],"COLUMNNAMES":["myC\
olumnName1","myColumnName2","myColumnName3",.
. ...],"js73012":{"CURRENTROW":1,"c1":9,"c2":2006,"c3":007,. . ....}

all so I can build a table in a form with dynamically named checkboxs.

But am I reinventing the wheel here? Should I be using stuff from
prototype.js?


>From: "Atif Aziz" <atif.aziz@...>
>Reply-To: json@yahoogroups.com
>To: <json@yahoogroups.com>
>Subject: RE: [json] json as js variable
>Date: Tue, 19 Dec 2006 14:30:48 +0100
>
>I think I know what you're looking for here. Suppose the following
>table:
>
>var table = {
>   "columns" : [ "FirstName", "LastName" ],
>   "rows" : [
>     [ "Mickey", "Mouse" ],
>     [ "Donald", "Duck" ],
>     [ "Minnie", "Mouse" ]
>   ]
>};
>
>Suppose further a function we add to the Array object's prototype:
>
>Array.prototype.toObject = function(names)
>{
>     var o = {};
>     for (var i = 0; i < names.length; i++)
>         o[names[i]] = i < this.length ? this[i] : null;
>
>     return o;
>}
>
>Now you can conveniently convert any row of the table into an object in
>one swell swoop like this:
>
>var o = table.rows[1].toObject(table.columns);
>
>This gives you non-repeating column names in the original table
>definition in JSON, which may be useful to keep the data on the wire
>small, yet object-like access (dot-syntax) to a row once in script.
>
>Hope this help.
>
>-----Original Message-----
>From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
>Mark Ireland
>Sent: Sunday, December 17, 2006 11:19 PM
>To: json@yahoogroups.com
>Subject: Re: [json] json as js variable
>
>
>Thanks, that got it working.
>
>Now I am wondering if there is some alternative to repeating the column
>names in every object.
>
> >From: "Matthew Morley" <WickedLogic@...
><mailto:WickedLogic%40gmail.com> >
> >Reply-To: json@yahoogroups.com <mailto:json%40yahoogroups.com>
> >To: json@yahoogroups.com <mailto:json%40yahoogroups.com>
> >Subject: Re: [json] json as js variable
> >Date: Mon, 11 Dec 2006 06:41:03 -0500
> >
> >*Identifiers* are names for constants, variables, functions, loop
>labels,
> >objects and classes. The first character must be an ASCII letter,
> >underscore
> >or dollar sign. Following characters can also include digits.
> >
> >Even 'u80020' will do. You can only use numeric indexes if you are
> >producing
> >an array.
> >
> >--
> >Matthew P. C. Morley
> >
> >
> >[Non-text portions of this message have been removed]
> >
>
>__________________________________________________________
>Join the millions of Australians using Live Search. Try live.com.au
>http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=740&re
>ferral=million&URL=http://live.com.au
><http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=740&r
>eferral=million&URL=http://live.com.au>
>
>
>
>

_________________________________________________________________
Join the millions of Australians using Live Search. Try live.com.au
http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&clientID=740&referral=m\
illion&URL=http://live.com.au

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

Messages 630 - 659 of 1953   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