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: 591
  • 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 1644 - 1673 of 1955   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1644 From: "marsdenjw" <j.w.marsden@...>
Date: Mon May 16, 2011 11:13 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
marsdenjw
Send Email Send Email
 
Wow, JSONiJ sucks.

Regards,

John (Developer, JSONiJ)

--- In json@yahoogroups.com, "uriel.chemouni" <uriel.chemouni@...> wrote:
>
> Hi
>
> I have recently published my Json API.
>
> Features test:
> http://code.google.com/p/json-smart/wiki/FeaturesTests
>
> Benches test:
> http://code.google.com/p/json-smart/wiki/Benchmark
>
> Project home;
> http://code.google.com/p/json-smart
>
> Don't hesitate to send me your feedback.
>

#1645 From: "uriel.chemouni" <uriel.chemouni@...>
Date: Mon May 16, 2011 11:43 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
Each test has a tag, to show if the test is a standard test, or not.

I have to add this information in my wiki page.

The score line is incremented by 100 by standard test, 10 by non-strict test
(like using ' instead of "), and 1 for strange test.

--- In json@yahoogroups.com, Petri Lehtinen <petri@...> wrote:
>
> uriel.chemouni wrote:
> > Hi
> >
> > I have recently published my Json API.
> >
> > Features test:
> > http://code.google.com/p/json-smart/wiki/FeaturesTests
> >
> > Benches test:
> > http://code.google.com/p/json-smart/wiki/Benchmark
> >
> > Project home;
> > http://code.google.com/p/json-smart
> >
> > Don't hesitate to send me your feedback.
>
> It seems you have implemented your own data format that you call
> "smaller JSON data". It's wrong to call this format JSON as it
> violates the JSON spec in many ways.
>
> It's also very misleading and unfair to use this syntax when comparing
> to other JSON libraries, as if they were supposed to support this
> non-JSON data format. More than half of the test cases you list on the
> FeatureTests page are not JSON at all, but still you expect others to
> parse them without throwing an error.
>

#1646 From: Uriel Chemouni <uriel.chemouni@...>
Date: Mon May 16, 2011 1:26 pm
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
I have change features test page, and separate standard and non-standard
Tests.

thanks for this comments..


On Mon, May 16, 2011 at 12:46 PM, Petri Lehtinen <petri@...> wrote:

> uriel.chemouni wrote:
> > Hi
> >
> > I have recently published my Json API.
> >
> > Features test:
> > http://code.google.com/p/json-smart/wiki/FeaturesTests
> >
> > Benches test:
> > http://code.google.com/p/json-smart/wiki/Benchmark
> >
> > Project home;
> > http://code.google.com/p/json-smart
> >
> > Don't hesitate to send me your feedback.
>
> It seems you have implemented your own data format that you call
> "smaller JSON data". It's wrong to call this format JSON as it
> violates the JSON spec in many ways.
>
> It's also very misleading and unfair to use this syntax when comparing
> to other JSON libraries, as if they were supposed to support this
> non-JSON data format. More than half of the test cases you list on the
> FeatureTests page are not JSON at all, but still you expect others to
> parse them without throwing an error.
>


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

#1647 From: Tatu Saloranta <tsaloranta@...>
Date: Mon May 16, 2011 3:53 pm
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
cowtowncoder
Send Email Send Email
 
On Mon, May 16, 2011 at 3:16 AM, uriel.chemouni
<uriel.chemouni@...> wrote:
> Hi
>
> I have recently published my Json API.
>
> Features test:
> http://code.google.com/p/json-smart/wiki/FeaturesTests
>
> Benches test:
> http://code.google.com/p/json-smart/wiki/Benchmark
>
> Project home;
> http://code.google.com/p/json-smart
>
> Don't hesitate to send me your feedback.

Performance test section could surely use some work. It tells very
little, but makes big unsubstantiated claims regarding performance.

For example:

- where is source?
- JSON used?
- why is JVM not warmed up -- by numbers it looks like numbers are
dominated by JVM/HotSpot runup times
- why not use one of existing frameworks to get at least some
semblance of due diligence wrt run times, variances and so on?

I also agree in that it is wrong to call this json anything, given
that it is for data format that looks a bit like JSON; should be
called something else.
And from this, comparing performance to real JSON parsers is somewhat
odd, since parsers actually work on different data formats.

-+ Tatu +-

#1648 From: "uriel.chemouni" <uriel.chemouni@...>
Date: Mon May 16, 2011 4:41 pm
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
Hi  Tatu,
> - where is source?

I can publish (I'm not shure) a working copy of the benching software, due to
dépendances licence.
However I have just upload the full benchmark package in the SVN of json-smart:
http://json-smart.googlecode.com/svn/trunk/bench/

> - JSON used?
json data look ,like:
{"K1":"V1","K2":"V2","K3":"V3"}
Key can be: "firstname", "lastname", "date", "len", "shape", "gate", "foo",
"bar", "city", "site", "url", "age", "action", "level", "password", "color",
"case"

V* : depending of the test (int, float, unicode, boolean...)

see
http://json-smart.googlecode.com/svn/trunk/bench/src/net/minidev/bench/json/Test\
Data.java
  for more details.

> - why is JVM not warmed up -- by numbers it looks like numbers are
> dominated by JVM/HotSpot runup times
true, those bench include classPathLoading.
I should add a warmed up benchmark.


> - why not use one of existing frameworks to get at least some
> semblance of due diligence wrt run times, variances and so on?

TODO :)

> I also agree in that it is wrong to call this json anything, given
> that it is for data format that looks a bit like JSON; should be
> called something else.

By default Json-smart only using strict Json data, I only use compact json to
fill my Mysql varchar(255) collumns.

> And from this, comparing performance to real JSON parsers is somewhat
> odd, since parsers actually work on different data formats.
>
> -+ Tatu +-

Uriel


--- In json@yahoogroups.com, Tatu Saloranta <tsaloranta@...> wrote:
>
> On Mon, May 16, 2011 at 3:16 AM, uriel.chemouni
> <uriel.chemouni@...> wrote:
> > Hi
> >
> > I have recently published my Json API.
> >
> > Features test:
> > http://code.google.com/p/json-smart/wiki/FeaturesTests
> >
> > Benches test:
> > http://code.google.com/p/json-smart/wiki/Benchmark
> >
> > Project home;
> > http://code.google.com/p/json-smart
> >
> > Don't hesitate to send me your feedback.
>
> Performance test section could surely use some work. It tells very
> little, but makes big unsubstantiated claims regarding performance.
>
> For example:
>
> - where is source?
> - JSON used?
> - why is JVM not warmed up -- by numbers it looks like numbers are
> dominated by JVM/HotSpot runup times
> - why not use one of existing frameworks to get at least some
> semblance of due diligence wrt run times, variances and so on?
>
> I also agree in that it is wrong to call this json anything, given
> that it is for data format that looks a bit like JSON; should be
> called something else.
> And from this, comparing performance to real JSON parsers is somewhat
> odd, since parsers actually work on different data formats.
>
> -+ Tatu +-
>

#1649 From: Tatu Saloranta <tsaloranta@...>
Date: Mon May 16, 2011 7:37 pm
Subject: Re: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
cowtowncoder
Send Email Send Email
 
On Mon, May 16, 2011 at 9:41 AM, uriel.chemouni
<uriel.chemouni@...> wrote:
> Hi  Tatu,
>> - where is source?
>
> I can publish (I'm not shure) a working copy of the benching software, due to
dépendances licence.
> However I have just upload the full benchmark package in the SVN of
json-smart:
> http://json-smart.googlecode.com/svn/trunk/bench/

Great, thanks!

...
>> - why is JVM not warmed up -- by numbers it looks like numbers are
>> dominated by JVM/HotSpot runup times
> true, those bench include classPathLoading.
> I should add a warmed up benchmark.

Yes, this makes big difference. Usually relative short amount of time
works ok (like 5 seconds per test).

>> - why not use one of existing frameworks to get at least some
>> semblance of due diligence wrt run times, variances and so on?
>
> TODO :)

:)

One other thing that may be problematic is that input is given as a
String: while I understand that this is sometimes useful, more often
input comes as a byte stream (over the network, from file), and so
step of converting byte input to String should actually be measured as
its efficiency varies a lot between implementations: some implement
efficient conversions whereas others rely on slower default
mechanisms.
This is why most JSON benchmarks (or general purpose JVM tests like
https://github.com/eishay/jvm-serializers/wiki) hand a byte[] to
deserializers.

Good luck!

-+ Tatu +-

#1650 From: Stephan Beal <sgbeal@...>
Date: Mon May 16, 2011 7:53 pm
Subject: Re: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
stephan.beal
Send Email Send Email
 
>
> By default Json-smart only using strict Json data, I only use compact json
> to fill my Mysql varchar(255) collumns.
>

If you'll make the columns of type TEXT, the stored JSON can have any size.
i use this in a wiki back-end which stores pages in JSON form.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/


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

#1651 From: "marsdenjw" <j.w.marsden@...>
Date: Tue May 17, 2011 1:14 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
marsdenjw
Send Email Send Email
 
Hello Uriel,

I think benchmarking is a great way to compare the frameworks (and motivate lazy
developers like myself who never finish anything). I run the JSONiJ failed tests
on the latest release and I get one fail and another which is open for
discussion.

Unit test: http://pastebin.com/SjuzXxTb
Output: http://pastebin.com/4GYbHwKq

Specifically, it passes,

1. Support Empty Object
2. Support simple Object float value
3. Support lowcase float value
4. Array of empty Object

Its questionable if I pass
1. Bigint number support - I can see why this is an issue. I put it in that
notation on purpose, but if its a key to something then it will break it.
         Input: { "v":123456789123456789123456789}
         Output: {"v":1.2345678912345679E26}

I totally fail
1. Double precision floating point

I will see if I can get your harness up and running and see if I can see why. At
the moment i am working so it will have to wait.

John

--- In json@yahoogroups.com, "marsdenjw" <j.w.marsden@...> wrote:
>
> Wow, JSONiJ sucks.
>
> Regards,
>
> John (Developer, JSONiJ)
>
> --- In json@yahoogroups.com, "uriel.chemouni" <uriel.chemouni@> wrote:
> >
> > Hi
> >
> > I have recently published my Json API.
> >
> > Features test:
> > http://code.google.com/p/json-smart/wiki/FeaturesTests
> >
> > Benches test:
> > http://code.google.com/p/json-smart/wiki/Benchmark
> >
> > Project home;
> > http://code.google.com/p/json-smart
> >
> > Don't hesitate to send me your feedback.
> >
>

#1652 From: "uriel.chemouni" <uriel.chemouni@...>
Date: Tue May 17, 2011 8:01 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
This table is more than 150 000 000 lines long, switching to text will
dramatically impact performances, and disk usage.

--- In json@yahoogroups.com, Stephan Beal <sgbeal@...> wrote:
>
> >
> > By default Json-smart only using strict Json data, I only use compact json
> > to fill my Mysql varchar(255) collumns.
> >
>
> If you'll make the columns of type TEXT, the stored JSON can have any size.
> i use this in a wiki back-end which stores pages in JSON form.
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
>
> [Non-text portions of this message have been removed]
>

#1653 From: "Douglas Crockford" <douglas@...>
Date: Thu May 19, 2011 6:44 am
Subject: json-ro
douglascrock...
Send Email Send Email
 
The JSON.org page is now available in Romanian. Thanks to Chris Plutis for the
translation.

#1654 From: "jonerlandmadsen" <jon.erland.madsen@...>
Date: Thu May 19, 2011 1:47 pm
Subject: Helpless beginner
jonerlandmadsen
Send Email Send Email
 
Hi!

I am trying to get an answer to what must be JSON-question number two, but
apparently, the answer to my question is too obvious to be included in the Q&As
I've found.

I will use an external JSON-array in my javascript. It originates from our own
server, so there are no security concerns.

The address is be for instance:

http://www.mysite.no/services/product/list/

According to Wikipedia, I can make an object out of it, using "eval". The
example given is:


var p = eval("(" + contact + ")");


..where 'contact' is the json array contained in a text object.

But there must be a step between, that is not explained. The
aforementioned external json array has no name. It just starts with a
paranthesis [

I would thus have to convert it into a string first. How do I do that
(javascript does not allow you to read external files into a string, as for
instance php does).

Can I convert a json array directly using the url as an argument in eval()
(probably not)?

I have programmed for 20 years (!) but never used JSON. I feel like a
complete fool. I've searched the internet two hours for the answer to
this. Even googling json+dummies or json+newbie didn't help. They all write
about different parsers.

If you could help me, I would be very grateful.

#1655 From: Martin Cooper <mfncooper@...>
Date: Thu May 19, 2011 2:16 pm
Subject: Re: Helpless beginner
mfncooper
Send Email Send Email
 
On Thu, May 19, 2011 at 6:47 AM, jonerlandmadsen
<jon.erland.madsen@...> wrote:
>
> Hi!
>
> I am trying to get an answer to what must be JSON-question number two, but
apparently, the answer to my question is too obvious to be included in the Q&As
I've found.
>
> I will use an external JSON-array in my javascript. It originates from our own
server, so there are no security concerns.
>
> The address is be for instance:
>
> http://www.mysite.no/services/product/list/
>
> According to Wikipedia, I can make an object out of it, using "eval". The
example given is:
>
>
> var p = eval("(" + contact + ")");
>
>
> ..where 'contact' is the json array contained in a text object.
>
> But there must be a step between, that is not explained. The
> aforementioned external json array has no name. It just starts with a
paranthesis [
>
> I would thus have to convert it into a string first. How do I do that
(javascript does not allow you to read external files into a string, as for
instance php does).
>

I think perhaps your problem is not a JSON problem per se, which may
be why you're having some trouble finding the answer. If your server
is producing a JSON array, that is your string right there. So the
question really is, how are you calling your server to get that
string?

How you do that depends on your client environment. If you're running
in a browser, you'll want to make an Ajax call. If you're using a
framework, it will have support for that, so check your framework
docs. If you're not using a framework, you'll want to work with the
XMLHttpRequest object. If you're running on the server - for example,
in Node.js - you'll want to make an HTTP request to your server to get
the JSON string.

Once you have the string from your server, you can eval() it, or,
better, JSON.parse() it, to get your array.

Hope that helps.

--
Martin Cooper


> Can I convert a json array directly using the url as an argument in eval()
(probably not)?
>
> I have programmed for 20 years (!) but never used JSON. I feel like a
> complete fool. I've searched the internet two hours for the answer to
> this. Even googling json+dummies or json+newbie didn't help. They all write
about different parsers.
>
> If you could help me, I would be very grateful.
>
>
>
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>

#1656 From: Stephan Beal <sgbeal@...>
Date: Thu May 19, 2011 2:31 pm
Subject: Re: Helpless beginner
stephan.beal
Send Email Send Email
 
On Thu, May 19, 2011 at 3:47 PM, jonerlandmadsen <
jon.erland.madsen@...> wrote:

> According to Wikipedia, I can make an object out of it, using "eval". The
> example given is:
>
> var p = eval("(" + contact + ")");
>
> ..where 'contact' is the json array contained in a text object.
>
> But there must be a step between, that is not explained.
>

Nope. JSON is a subset of JavaScript and eval() runs the JavaScript which is
passed to it. The extra parenthesis are a workaround (for what, exactly, i
don't remember).


> The
> aforementioned external json array has no name. It just starts with a
> paranthesis [
>

After the above line runs, it has the name 'p' (the name you gave it).

--
----- stephan beal
http://wanderinghorse.net/home/stephan/


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

#1657 From: "jonerlandmadsen" <jon.erland.madsen@...>
Date: Thu May 19, 2011 2:41 pm
Subject: Re: Helpless beginner
jonerlandmadsen
Send Email Send Email
 
--- In json@yahoogroups.com, Stephan Beal <sgbeal@...> wrote:
>
> On Thu, May 19, 2011 at 3:47 PM, jonerlandmadsen <
> jon.erland.madsen@...> wrote:
>
> > According to Wikipedia, I can make an object out of it, using "eval". The
> > example given is:
> >
> > var p = eval("(" + contact + ")");
> >
> > ..where 'contact' is the json array contained in a text object.
> >
> > But there must be a step between, that is not explained.
> >
>
> Nope. JSON is a subset of JavaScript and eval() runs the JavaScript which is
> passed to it. The extra parenthesis are a workaround (for what, exactly, i
> don't remember).
>
>
> > The
> > aforementioned external json array has no name. It just starts with a
> > paranthesis [
> >
>
> After the above line runs, it has the name 'p' (the name you gave it).
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
>
> [Non-text portions of this message have been removed]
>

Thank you for your kind answer, but it does not address my problem: How to get
the external json array into a text string (that can then be parsed).

#1658 From: Stephan Beal <sgbeal@...>
Date: Thu May 19, 2011 3:12 pm
Subject: Re: Re: Helpless beginner
stephan.beal
Send Email Send Email
 
On Thu, May 19, 2011 at 4:41 PM, jonerlandmadsen <
jon.erland.madsen@...> wrote:

> Thank you for your kind answer, but it does not address my problem: How to
> get the external json array into a text string (that can then be parsed).
>

You already have it: the "contact" string is the array, as a JSON-formatted
string.


--
----- stephan beal
http://wanderinghorse.net/home/stephan/


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

#1659 From: Connie Clark <connie.clark@...>
Date: Thu May 19, 2011 4:00 pm
Subject: Re: Helpless beginner
connieclark68
Send Email Send Email
 
Here are several patterns I often use which may help you

*If the list data is available at the time your server is
returning the rest of the page content
*
Pattern.1:

   Have the server emit a script tag that pulls in
   your javascript code for doing something with the list,
   say a function called handleMyList.

   Have the server then emit (within script tags)
      handleMyList( [ item1, item2, item2 ] );


Pattern.2:

    Have the server emit (within script tags)
      var listArr = [ item1, item2, item3 ];

    Then have the server emit a script tag that
     pulls in your javascript code for doing something
     with listArr.



*If you need to request the list after the user has
done other selections:*

    This is quite similar to Pattern.1, but you
    would use an AJAX style request to get the
    content back.

    *OR, to do it "by hand"*

       On your HTML page
          define an iframe IFR
          define a form F
            with action: serverUrl
                   target: IFR
              and hidden fields for any parameters
               you need to pass

       When the user makes their selection
              F.parm1.value = "..."
              F.submit();

    Have the server return (within script tags)
      parent.top.handleMyList( [ item1, item2, item3 ]);

Connie


On Thu, May 19, 2011 at 6:47 AM, jonerlandmadsen <
jon.erland.madsen@...> wrote:

>
> Hi!
>
> I am trying to get an answer to what must be JSON-question number two, but
> apparently, the answer to my question is too obvious to be included in the
> Q&As I've found.
>
> I will use an external JSON-array in my javascript. It originates from our
> own server, so there are no security concerns.
>
> The address is be for instance:
>
> http://www.mysite.no/services/product/list/
>
> According to Wikipedia, I can make an object out of it, using "eval". The
> example given is:
>
>
> var p = eval("(" + contact + ")");
>
>
> ..where 'contact' is the json array contained in a text object.
>
> But there must be a step between, that is not explained. The
> aforementioned external json array has no name. It just starts with a
> paranthesis [
>
> I would thus have to convert it into a string first. How do I do that
> (javascript does not allow you to read external files into a string, as for
> instance php does).
>
> Can I convert a json array directly using the url as an argument in eval()
> (probably not)?
>
> I have programmed for 20 years (!) but never used JSON. I feel like a
> complete fool. I've searched the internet two hours for the answer to
> this. Even googling json+dummies or json+newbie didn't help. They all write
> about different parsers.
>
> If you could help me, I would be very grateful.
>
>
>
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


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

#1660 From: jon.erland.madsen@...
Date: Thu May 19, 2011 4:57 pm
Subject: Re: Helpless beginner
jonerlandmadsen
Send Email Send Email
 
Thank you so very much!

I got help and will use the following code (my script is client side):

**********************************************

function createXMLHttpRequest()
{
   try { return new XMLHttpRequest(); } catch(e) {}
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   return null;
}

var url = "http://www.finansportalen.no/services/sph/produkt/list/";
var xhReq = createXMLHttpRequest();
xhReq.open("GET", url, false);
xhReq.send(null);

var sphdata = eval(xhReq.responseText);

**********************************************

(I would have prefered, however, to have the object declared by the server
and posted as a .js file i could simply include, thus enabling me to
access it directly. But the above will do.)

Thanks again!





Here are several patterns I often use which may help you

*If the list data is available at the time your server is
returning the rest of the page content
*
Pattern.1:

   Have the server emit a script tag that pulls in
   your javascript code for doing something with the list,
   say a function called handleMyList.

   Have the server then emit (within script tags)
      handleMyList( [ item1, item2, item2 ] );


Pattern.2:

    Have the server emit (within script tags)
      var listArr = [ item1, item2, item3 ];

    Then have the server emit a script tag that
     pulls in your javascript code for doing something
     with listArr.



*If you need to request the list after the user has
done other selections:*

    This is quite similar to Pattern.1, but you
    would use an AJAX style request to get the
    content back.

    *OR, to do it "by hand"*

       On your HTML page
          define an iframe IFR
          define a form F
            with action: serverUrl
                   target: IFR
              and hidden fields for any parameters
               you need to pass

       When the user makes their selection
              F.parm1.value = "..."
              F.submit();

    Have the server return (within script tags)
      parent.top.handleMyList( [ item1, item2, item3 ]);

Connie


On Thu, May 19, 2011 at 6:47 AM, jonerlandmadsen <
jon.erland.madsen@...> wrote:

>
> Hi!
>
> I am trying to get an answer to what must be JSON-question number two,
> but
> apparently, the answer to my question is too obvious to be included in
> the
> Q&As I've found.
>
> I will use an external JSON-array in my javascript. It originates from
> our
> own server, so there are no security concerns.
>
> The address is be for instance:
>
> http://www.mysite.no/services/product/list/
>
> According to Wikipedia, I can make an object out of it, using "eval".
> The
> example given is:
>
>
> var p = eval("(" + contact + ")");
>
>
> ..where 'contact' is the json array contained in a text object.
>
> But there must be a step between, that is not explained. The
> aforementioned external json array has no name. It just starts with a
> paranthesis [
>
> I would thus have to convert it into a string first. How do I do that
> (javascript does not allow you to read external files into a string, as
> for
> instance php does).
>
> Can I convert a json array directly using the url as an argument in
> eval()
> (probably not)?
>
> I have programmed for 20 years (!) but never used JSON. I feel like a
> complete fool. I've searched the internet two hours for the answer to
> this. Even googling json+dummies or json+newbie didn't help. They all
> write
> about different parsers.
>
> If you could help me, I would be very grateful.
>
>
>
>
>
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


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

#1661 From: "kylealanhale" <kylealanhale@...>
Date: Fri May 20, 2011 3:07 pm
Subject: Re: Helpless beginner
kylealanhale
Send Email Send Email
 
I want to clarify a couple of things that no one else seems to have
addressed:
* There is no such thing as "an external JSON-array"; JSON is just a
data transfer format, or, more correctly, a data transfer notation
(JavaScript Object Notation).  What you described in your last post, of
defining the array in a javascript file that you include in your page,
is not JSON at all, just JavaScript.
* You should never transfer JSON-encoded data as an array; this opens a
security vulnerability (see
http://directwebremoting.org/blog/joe/2007/03/05/json_is_not_as_safe_as_\
people_think_it_is.html for a good summary of the issue); instead,
always enclose it in an object.  So instead of your data looking like
[{"key1": "value1"}, {"key2": "value2"}...], make it look like {"list":
[{"key1": "value1"}, {"key2": "value2"}...]}.
* You should also never use eval(), for reasons that have been explained
extensively elsewhere, including several times by the brainfather of
JSON himself, and in the very Wikipedia article you quoted from
originally <http://en.wikipedia.org/wiki/JSON#Security_issues>.  Instead
use JSON.parse, which is standard in all major browsers now.
* If you want to get a JavaScript object from a JSON-encoded source
while working from the browser, you will invariably use XHR (AJAX, if
you must).  The method you posted is exactly how you would do that, with
the exception that you'd probably want to do it asynchronously and
handle the data in a callback, rather than procedurally.  Also, if you
use a JavaScript framework, it will generally make your life much easier
and your code much cleaner.  A jQuery example:
$.getJSON('http://www.mysite.no/services/product/list/', function(data)
{ $.each(data.list, function (index, listItem) {     // Do something
which each item in the list });});
    Note that this function takes care of (safely) decoding your
JSON-encoded data so that you can handle it as a native JavaScript
object.  See http://api.jquery.com/jQuery.getJSON/ and
http://api.jquery.com/jQuery.ajax/ for more details.
* While there are exceptions to all of these, and things I have left
out, this is a good starting place for best-practices, I think.


--- In json@yahoogroups.com, jon.erland.madsen@... wrote:
>
> Thank you so very much!
>
> I got help and will use the following code (my script is client side):
>
> **********************************************
>
> function createXMLHttpRequest()
> {
>   try { return new XMLHttpRequest(); } catch(e) {}
>   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
>   return null;
> }
>
> var url = "http://www.finansportalen.no/services/sph/produkt/list/";
> var xhReq = createXMLHttpRequest();
> xhReq.open("GET", url, false);
> xhReq.send(null);
>
> var sphdata = eval(xhReq.responseText);
>
> **********************************************
>
> (I would have prefered, however, to have the object declared by the
server
> and posted as a .js file i could simply include, thus enabling me to
> access it directly. But the above will do.)
>
> Thanks again!
>



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

#1662 From: "uriel.chemouni" <uriel.chemouni@...>
Date: Sat May 21, 2011 5:35 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
Great, JSONiJ 0.2.3.9 can now validate all my tests.

It deserves an update results in json-smart.

Good job jhon.

--- In json@yahoogroups.com, "marsdenjw" <j.w.marsden@...> wrote:
>
> Hello Uriel,
>
> I think benchmarking is a great way to compare the frameworks (and motivate
lazy developers like myself who never finish anything). I run the JSONiJ failed
tests on the latest release and I get one fail and another which is open for
discussion.
>
> Unit test: http://pastebin.com/SjuzXxTb
> Output: http://pastebin.com/4GYbHwKq
>
> Specifically, it passes,
>
> 1. Support Empty Object
> 2. Support simple Object float value
> 3. Support lowcase float value
> 4. Array of empty Object
>
> Its questionable if I pass
> 1. Bigint number support - I can see why this is an issue. I put it in that
notation on purpose, but if its a key to something then it will break it.
>         Input: { "v":123456789123456789123456789}
>         Output: {"v":1.2345678912345679E26}
>
> I totally fail
> 1. Double precision floating point
>
> I will see if I can get your harness up and running and see if I can see why.
At the moment i am working so it will have to wait.
>
> John
>
> --- In json@yahoogroups.com, "marsdenjw" <j.w.marsden@> wrote:
> >
> > Wow, JSONiJ sucks.
> >
> > Regards,
> >
> > John (Developer, JSONiJ)
> >
> > --- In json@yahoogroups.com, "uriel.chemouni" <uriel.chemouni@> wrote:
> > >
> > > Hi
> > >
> > > I have recently published my Json API.
> > >
> > > Features test:
> > > http://code.google.com/p/json-smart/wiki/FeaturesTests
> > >
> > > Benches test:
> > > http://code.google.com/p/json-smart/wiki/Benchmark
> > >
> > > Project home;
> > > http://code.google.com/p/json-smart
> > >
> > > Don't hesitate to send me your feedback.
> > >
> >
>

#1663 From: "marsdenjw" <j.w.marsden@...>
Date: Sat May 21, 2011 10:47 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
marsdenjw
Send Email Send Email
 
No problem - as I said. I think its a good way to compare frameworks.

I am working on making it a little bit quicker now. It was built to parse input
streams directly and not strings. The String current string parse is fine for
small strings, but when they get large like your tests its a bit silly.

https://bitbucket.org/openecho/jsonij/src/653c6b5f85c8/src/main/java/jsonij/json\
/JSONParser.java#cl-90

It pushes the string contents into a byte buffer and then reads the bytes. Its
not too much work to make another version of the reader itself to work directly
on the input string.

John

--- In json@yahoogroups.com, "uriel.chemouni" <uriel.chemouni@...> wrote:
>
> Great, JSONiJ 0.2.3.9 can now validate all my tests.
>
> It deserves an update results in json-smart.
>
> Good job jhon.
>
> --- In json@yahoogroups.com, "marsdenjw" <j.w.marsden@> wrote:
> >
> > Hello Uriel,
> >
> > I think benchmarking is a great way to compare the frameworks (and motivate
lazy developers like myself who never finish anything). I run the JSONiJ failed
tests on the latest release and I get one fail and another which is open for
discussion.
> >
> > Unit test: http://pastebin.com/SjuzXxTb
> > Output: http://pastebin.com/4GYbHwKq
> >
> > Specifically, it passes,
> >
> > 1. Support Empty Object
> > 2. Support simple Object float value
> > 3. Support lowcase float value
> > 4. Array of empty Object
> >
> > Its questionable if I pass
> > 1. Bigint number support - I can see why this is an issue. I put it in that
notation on purpose, but if its a key to something then it will break it.
> >         Input: { "v":123456789123456789123456789}
> >         Output: {"v":1.2345678912345679E26}
> >
> > I totally fail
> > 1. Double precision floating point
> >
> > I will see if I can get your harness up and running and see if I can see
why. At the moment i am working so it will have to wait.
> >
> > John
> >
> > --- In json@yahoogroups.com, "marsdenjw" <j.w.marsden@> wrote:
> > >
> > > Wow, JSONiJ sucks.
> > >
> > > Regards,
> > >
> > > John (Developer, JSONiJ)
> > >
> > > --- In json@yahoogroups.com, "uriel.chemouni" <uriel.chemouni@> wrote:
> > > >
> > > > Hi
> > > >
> > > > I have recently published my Json API.
> > > >
> > > > Features test:
> > > > http://code.google.com/p/json-smart/wiki/FeaturesTests
> > > >
> > > > Benches test:
> > > > http://code.google.com/p/json-smart/wiki/Benchmark
> > > >
> > > > Project home;
> > > > http://code.google.com/p/json-smart
> > > >
> > > > Don't hesitate to send me your feedback.
> > > >
> > >
> >
>

#1664 From: Tatu Saloranta <tsaloranta@...>
Date: Sat May 21, 2011 4:20 pm
Subject: Re: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
cowtowncoder
Send Email Send Email
 
On Sat, May 21, 2011 at 3:47 AM, marsdenjw <j.w.marsden@...> wrote:
> No problem - as I said. I think its a good way to compare frameworks.

Are these tests also available with source code? Results for Jackson
looked odd; as if some assumptions were being made that are not true
(assuming round-tripping of white space, or specific style of escaping
characters)

>
> I am working on making it a little bit quicker now. It was built to parse
input streams directly and not strings. The String current string parse is fine
for small strings, but when they get large like your tests its a bit silly.

I think using String as input does not make much sense -- most
real-world use cases start with a byte sequence (reading from a file,
receiving or sending requests), and it is only question of who does
decoding/encoding necessary. When starting with a String (or Reader)
it is assumed that parser can not do this, which is true for some
parsers but not all. And since encoding/decoding between bytes and
characters is a major factor in performance, this skews results a lot.

-+ Tatu +-

#1665 From: "marsdenjw" <j.w.marsden@...>
Date: Mon May 23, 2011 10:49 am
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
marsdenjw
Send Email Send Email
 
Hi Tatu,

If that question was addressed to me, then no, I dont have the source. I just
made unit tests for each test I was said to fail and went from there
(https://bitbucket.org/openecho/jsonij/src/a25fd28c1d77/src/test/java/jsonij/jso\
n/SJTest.java). Im not sure how fussy his code is about spaces and differences
in valid results...

I agree totally with the byte sequence comment. Every time I use JSON I am
parsing from a HTTP source or I am loading from a file.

Regards,

John

--- In json@yahoogroups.com, Tatu Saloranta <tsaloranta@...> wrote:
>
> On Sat, May 21, 2011 at 3:47 AM, marsdenjw <j.w.marsden@...> wrote:
> > No problem - as I said. I think its a good way to compare frameworks.
>
> Are these tests also available with source code? Results for Jackson
> looked odd; as if some assumptions were being made that are not true
> (assuming round-tripping of white space, or specific style of escaping
> characters)
>
> >
> > I am working on making it a little bit quicker now. It was built to parse
input streams directly and not strings. The String current string parse is fine
for small strings, but when they get large like your tests its a bit silly.
>
> I think using String as input does not make much sense -- most
> real-world use cases start with a byte sequence (reading from a file,
> receiving or sending requests), and it is only question of who does
> decoding/encoding necessary. When starting with a String (or Reader)
> it is assumed that parser can not do this, which is true for some
> parsers but not all. And since encoding/decoding between bytes and
> characters is a major factor in performance, this skews results a lot.
>
> -+ Tatu +-
>

#1666 From: Tatu Saloranta <tsaloranta@...>
Date: Mon May 23, 2011 5:42 pm
Subject: Re: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
cowtowncoder
Send Email Send Email
 
On Mon, May 23, 2011 at 3:49 AM, marsdenjw <j.w.marsden@...> wrote:
> Hi Tatu,
>
> If that question was addressed to me, then no, I dont have the source. I just
made unit tests for each test I was said to fail and went from there
(https://bitbucket.org/openecho/jsonij/src/a25fd28c1d77/src/test/java/jsonij/jso\
n/SJTest.java). Im not sure how fussy his code is about spaces and differences
in valid results...

Sorry, it was question to author, and he did actually add a link to
wiki. So I was able to figure it out, and submit a patch for jackson
test. I hope authors of other JSON libs can do the same, so that
results reflect actual working of libs.

> I agree totally with the byte sequence comment. Every time I use JSON I am
parsing from a HTTP source or I am loading from a file.

Yeah, that is my experience as well. Maybe this was based on using a
framework that does loading and decoding first, just passing JSON
contents. Occasionally this is true, when binding data from form
parameters or something. But not very often at least for me.

-+ Tatu +-

#1667 From: "uriel.chemouni" <uriel.chemouni@...>
Date: Mon May 23, 2011 5:49 pm
Subject: Re: A new java JSON API + Up to date benchmarks and test for most existing Json API.
uriel.chemouni
Send Email Send Email
 
do not hesitate to submit paths to my benchmark code.
The new version display warmed-up JVM result, and display all results as
percents.
The results are easier to read.

--- In json@yahoogroups.com, Tatu Saloranta <tsaloranta@...> wrote:
>
> On Mon, May 23, 2011 at 3:49 AM, marsdenjw <j.w.marsden@...> wrote:
> > Hi Tatu,
> >
> > If that question was addressed to me, then no, I dont have the source. I
just made unit tests for each test I was said to fail and went from there
(https://bitbucket.org/openecho/jsonij/src/a25fd28c1d77/src/test/java/jsonij/jso\
n/SJTest.java). Im not sure how fussy his code is about spaces and differences
in valid results...
>
> Sorry, it was question to author, and he did actually add a link to
> wiki. So I was able to figure it out, and submit a patch for jackson
> test. I hope authors of other JSON libs can do the same, so that
> results reflect actual working of libs.
>
> > I agree totally with the byte sequence comment. Every time I use JSON I am
parsing from a HTTP source or I am loading from a file.
>
> Yeah, that is my experience as well. Maybe this was based on using a
> framework that does loading and decoding first, just passing JSON
> contents. Occasionally this is true, when binding data from form
> parameters or something. But not very often at least for me.
>
> -+ Tatu +-
>

#1668 From: "mehdigholam@..." <mgholam@...>
Date: Thu Jun 9, 2011 6:12 am
Subject: TimeSpan type
mehdigholam...
Send Email Send Email
 
Hello,

As there is no JSON standard for serializing the .net TimeSpan type, are there
any suggestions?

We could do the following:
1. TimeSpan -> long value representing the ticks
2. TimeSpan -> string value like "ddd.HH:mm:ss.nnn"

#1669 From: Mark Slater <mark.slater@...>
Date: Thu Jun 9, 2011 7:32 am
Subject: Re: TimeSpan type
markosslater
Send Email Send Email
 
You might want to take a look at ISO 8061:
http://en.m.wikipedia.org/wiki/ISO_8601. I don't know about .Net, but many
languages have straightforward ways of converting to and from compliant strings.

Mark



On 9 Jun 2011, at 07:12, "mehdigholam@..." <mgholam@...> wrote:

> Hello,
>
> As there is no JSON standard for serializing the .net TimeSpan type, are there
any suggestions?
>
> We could do the following:
> 1. TimeSpan -> long value representing the ticks
> 2. TimeSpan -> string value like "ddd.HH:mm:ss.nnn"
>
>


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

#1670 From: John Cowan <cowan@...>
Date: Thu Jun 9, 2011 1:53 pm
Subject: Re: TimeSpan type
johnwcowan
Send Email Send Email
 
mehdigholam@... scripsit:

> 2. TimeSpan -> string value like "ddd.HH:mm:ss.nnn"

The ISO 8601 standard represents a duration in days, hours, minutes,
and seconds thus:  "PnnnDTnnHnnMnn.nnnS".  "P" indicates a duration and
is mandatory.  The nnnD, nnH, nnM, and nn.nnnS parts can be omitted if
they are zero, and you do not need to zero-pad the numeric values.  "T"
separates the date part from the time part, and is mandatory unless all
time values are omitted.

So P1D is one day, PT15H2S is fifteen hours and two seconds,
P1DT2H5M6.55S is one day, two hours, six minutes, and 6.550 seconds.
ISO 8601 has lots more bells and whistles, but this suffices for TimeSpan.

--
What asininity could I have uttered     John Cowan <cowan@...>
that they applaud me thus?              http://www.ccil.org/~cowan
         --Phocion, Greek orator

#1671 From: "Paul C. Bryan" <paul.bryan@...>
Date: Thu Jun 9, 2011 6:08 pm
Subject: JSON Patch Internet-Draft 01
paul.bryan@...
Send Email Send Email
 
The second draft of the JSON Patch proposal has been published:
http://tools.ietf.org/html/draft-pbryan-json-patch-01

Feedback would be most appreciated. The mailing list for this proposal
is:
https://groups.google.com/group/json-patch

Paul


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

#1672 From: Petri Lehtinen <petri@...>
Date: Sat Jun 11, 2011 8:19 pm
Subject: Jansson 2.1 released
akhern...
Send Email Send Email
 
Jansson 2.1 is out. This release adds a few new features and fixes
some minor bugs.

A new decoding function, json_loadb(), was added for decoding buffers
with length. The most important thing is that the input buffer need
not be null terminated.

Two new decoding flags and one new encoding flag were introduced:

* JSON_REJECT_DUPLICATES: Issue a decoding error if any JSON object in
   the input contins duplicate keys.

* JSON_DISABLE_EOF_CHECK: Stop decoding after a valid JSON input. This
   allows other data after the JSON data.

* JSON_ENCODE_ANY: Allow encoding any JSON value. Without this flag,
   only arrays and objects can be encoded as the root value.

Bugfixes:

* Fix a memory leak when memory allocation fails in json_object_set()
   and friends.

* Clear errno before calling strtod() for better portability (MINGW in
   this case).

* Avoid set-but-not-used warning/error when building with the newest
   GCC.

Download source: http://www.digip.org/jansson/releases/jansson-2.1.tar.gz
View documentation: http://www.digip.org/jansson/doc/2.1/
Changelog: http://www.digip.org/jansson/doc/2.1/changes.html#version-2-1


What is Jansson?
----------------

Jansson is a C library for encoding, decoding and manipulating JSON data.
It features:

* Simple and intuitive API and data model
* Comprehensive documentation
* No dependencies on other libraries
* Full Unicode support (UTF-8)
* Extensive test suite

Jansson is licensed under the MIT license.

For more details, see http://www.digip.org/jansson/.


Petri Lehtinen

#1673 From: "lambdacreations" <borislav.iordanov@...>
Date: Tue Jun 14, 2011 6:49 pm
Subject: and...another Java JSON
lambdacreations
Send Email Send Email
 
Hi all,

After reading up and using most the major Java JSON libraries, I thought I could
do something better (at least for needs similar
to my own's) and here is the result:

http://sharegov.blogspot.com/2011/06/json-library.html

The idea was to do an API that's simple, minimal and elegant, focusing
exclusively on JSON as a data structure.

Hoping that others will find it useful and pleasant to work with.

Best,
Boris

Messages 1644 - 1673 of 1955   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