473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

json-php on slashdot

In my journal anyway:

"JSON: Javascript Unusable by the Client"

http://slashdot.org/~scriptify/journal/103074

Jul 23 '05 #1
9 1500
"George Jempty" <sc*******@yahoo.com> writes:
In my journal anyway:

"JSON: Javascript Unusable by the Client"

http://slashdot.org/~scriptify/journal/103074


I must admit, I fail to see the point of your journal entry. It appears
to try to point out problems with JSON, but which problems? And are
they JSON problems or strawmen? (I'm leaning towards the latter).
quote: "This same sample data file specified as the src attribute of a
script tag results in a page throwing a Javascript error"

Well, what did you expect?

JSON is a *value* description language. It is a subset of ECMAScript's
literal notation, which is *expression* syntax. When you try loading
and evaluating it as a statement, it fails.

If you fetch the text using XMLHttpRequest and evaluates it using
"eval", then it works perfectly (and if you are targeting a browser
only, it's a much better format to send your data in than, e.g., XML).

You have a language for expression values. You want these values to
be available to your code, so you must have some way of getting the
text and parsing it.

*One* such way is to put the *JSON* text into a *Javascript*
assignment and load the assignment into a script tag on a web page.
That does not make the assignment part of the JSON value, nor
does it need to be.

But, looking at the *first* answer in the PHP-JSON thread linked to,
all this has already been said.
<URL:http://groups.yahoo.com/group/json-php/message/9>

Ah, I now see that you are the "scriptify" of that conversation.
I'll just chip in and say that Michal Migurski is *absolutely right*.

From what you have written so far, I am not able to see a need that
cannot be solved using PHP and the JSON library. If you can express
your need more clearly, I am certain we can find a way to fulfill it.

(On the other hand, the "sample data for a C# parser" does have an
error. It should not end with a semicolon).
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
Lasse Reichstein Nielsen wrote:
"George Jempty" <sc*******@yahoo.com> writes:
In my journal anyway:

"JSON: Javascript Unusable by the Client"

http://slashdot.org/~scriptify/journal/103074
I must admit, I fail to see the point of your journal entry. It

appears to try to point out problems with JSON, but which problems? And are
they JSON problems or strawmen? (I'm leaning towards the latter).
quote: "This same sample data file specified as the src attribute of a script tag results in a page throwing a Javascript error"

Well, what did you expect?

JSON is a *value* description language.


JSON is nothing but an idea: there's no official specification. Mine
is nothing but an idea to possibly improve it. A viable and easily
implementable idea to fully accomodate all manner of client side
scripting. An idea to spark debate. To perhaps get enough momementum
behind JSON so that it becomes a specification.

Or to result in a fork. I've already got my acronym ready. Help me
stir up some controversy.

"When a true genius appears, you can know him by this sign: that all
the dunces are in a confederacy against him. -- Jonathan Swift"

Jul 23 '05 #3
On 5 Apr 2005 13:31:52 -0700, "George Jempty" <sc*******@yahoo.com>
wrote:
JSON is nothing but an idea: there's no official specification.
Definie "official"
Mine is nothing but an idea to possibly improve it.
but you've not made a proposal to improve it, you've made a load of
complaints against an implementation that isn't in anyway wrong, and
doesn't even stop you doing exactly what you want to do.
To perhaps get enough momementum
behind JSON so that it becomes a specification.
There's no standards body appropriate to take it - ECMA, there's no
point, too expensive, W3, not chartered to do anything in the area, a
member submission perhaps, but that would be the end of it, and we'd
need to dig up a member to submit it (or a 11,000 dollars to become a
member) but it doesn't need to go before a standards body or
consortium, it has a specification already.
Or to result in a fork. I've already got my acronym ready. Help me
stir up some controversy.


but there is no controversy, there's just your strange complaint
against an implementation which the developers seem to have addressed
well by my reading.

Jim.
Jul 23 '05 #4
Jim Ley wrote:
On 5 Apr 2005 13:31:52 -0700, "George Jempty" <sc*******@yahoo.com>
wrote:
JSON is nothing but an idea: there's no official specification.


Definie "official"
Mine is nothing but an idea to possibly improve it.


but you've not made a proposal to improve it


I most certainly have, and more than once; I suggest you re-read my
comments.

"The purpose of the Rule of Least Surprise is to reduce the amount of
complexity a user must absorb to use an interface." -- Eric S Raymond

Jul 23 '05 #5
"George Jempty" <sc*******@yahoo.com> writes:
JSON is nothing but an idea: there's no official specification.
Douglas Crockford's specification exists. Whether it is official
or not is a matter of definition.
Mine is nothing but an idea to possibly improve it.
My problem with your suggestion is that I don't see what problem it
solves, that doesn't already have a simpler solution (if you can
explain the problem so that I can see that I am wrong at this, please
do).

Instead it complicates the specification with extra fluff that is only
relevant to one single, very specific, use of JSON: in webpages read
by browsers and added to the page by a Javascript script element with
only the JSON expression as the script code.
A viable and easily implementable idea to fully accomodate all
manner of client side scripting.
No, not all manner of client side scripting.
*Webpage* in a *browser* using *Javascript* and loading the JSON
expression using a *script element* with a *src attribute*.

Any of these could be changed, and your addition has just become
an obstacle. And if everything matches, there is no problem
adding the assignment to the script without adding it to the JSON
syntax.
An idea to spark debate. To perhaps get enough momementum behind
JSON so that it becomes a specification.
Debate is raging. Your side is not doing too well at convincing the
other side :)

Momentum will come with use. One of the strengths of JSON is its
simplicity and generality, both of which your suggested addition
goes against.
Or to result in a fork. I've already got my acronym ready. Help me
stir up some controversy.


I don't see a need for controversy. It works perfectly well as
written. Again, if you can show a situation where it doesn't, I'd be
happy to see it.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #6
Lee
George Jempty said:

Jim Ley wrote:
On 5 Apr 2005 13:31:52 -0700, "George Jempty" <sc*******@yahoo.com>
wrote:
>JSON is nothing but an idea: there's no official specification.


Definie "official"
> Mine is nothing but an idea to possibly improve it.


but you've not made a proposal to improve it


I most certainly have, and more than once; I suggest you re-read my
comments.


So far, everybody who's read your comments seems to disagree with you.
JSON defines a format for values. You're asking for it to also include the
assignment of the value to a variable. That's not an improvement.

Jul 23 '05 #7
Lasse Reichstein Nielsen wrote:
"George Jempty" <sc*******@yahoo.com> writes:
JSON is nothing but an idea: there's no official specification.
Douglas Crockford's specification exists. Whether it is official
or not is a matter of definition.
Mine is nothing but an idea to possibly improve it.


My problem with your suggestion is that I don't see what problem it
solves, that doesn't already have a simpler solution (if you can
explain the problem so that I can see that I am wrong at this, please
do).

Instead it complicates the specification with extra fluff that is

only relevant to one single, very specific, use of JSON: in webpages read
by browsers and added to the page by a Javascript script element with
only the JSON expression as the script code.


And this one single very specific use of JSON is *precisely* the way
you would expect to be able to use it. The way Javascript has been
getting done *for ten years*. A way prescribed by the W3C for using
Javascript.

And the way I am going to use it, if I have to fork my own "standard"
and write my own parsers.

Jul 23 '05 #8
"George Jempty" <sc*******@yahoo.com> writes:
Lasse Reichstein Nielsen wrote: ....
one single, very specific, use of JSON: in webpages read
by browsers and added to the page by a Javascript script element with
only the JSON expression as the script code.


And this one single very specific use of JSON is *precisely* the way
you would expect to be able to use it.


No, not only that specific use, but also the additional requirement
that the script contents must
1) be static (if dynamically generated, e.g., with PHP, it's trivial
to add the assignment before the JSON value)
2) contain *only* a valid JSON expression (since otherwise, you could
just let it contain the assignment as well)
The way Javascript has been getting done *for ten years*. A way
prescribed by the W3C for using Javascript.
Then keep doing it. But your requirements are unnecessary. Drop the
second requirement above, and you don't need to change JSON's
syntax. If I have misinterpreted it, please tell me where I missed the
point.
And the way I am going to use it, if I have to fork my own "standard"
and write my own parsers.


Go right ahead, but I think there are easier ways to solve whatever
problem you are trying to solve.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #9
> And this one single very specific use of JSON is *precisely* the way
you would expect to be able to use it. The way Javascript has been
getting done *for ten years*. A way prescribed by the W3C for using
Javascript.

And the way I am going to use it, if I have to fork my own "standard"
and write my own parsers.


The usage pattern you have been describing is brittle and badly
factored. You certainly have a right to practice bad design, though I
don't understand why anyone would want to pay you to do so.

The changes you are proposing to JSON are unnecessary and will tend to
promote bad practices. Fork if you must, but I think you would do better
to understand the comments of the other people who have contributed to
this topic.

http://www.JSON.org
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: G Matthew J | last post by:
http://htmatters.net/htm/1/2005/07/evaling-JSON.cfm This is more or less in response to Mr Crockford's admonition a few months ago, "fork if you must". Ironically, although in that usenet post...
20
by: Luke Matuszewski | last post by:
Welcome As suggested i looked into JSON project and was amazed but... What about cyclical data structures - anybody was faced it in some project ? Is there any satisactional recomendation... ...
8
by: Douglas Crockford | last post by:
There is a new version of JSON.parse in JavaScript. It is vastly faster and smaller than the previous version. It uses a single call to eval to do the conversion, guarded by a single regexp test to...
2
by: Kevin Newman | last post by:
Hello, I noticed that the JavaScript library for JSON posted on json.org (http://www.json.org/json.js) is modifying Object.prototype (adding a method - toJSONString). I thought this was...
3
by: Adam | last post by:
I'm trying to retrieve some values from a json object, but instead it's giving me the property name. For example: var json = { "glossary": { "title": "example glossary" } }; console.log(json);...
2
by: ChrisO | last post by:
I've been pretty infatuated with JSON for some time now since "discovering" it a while back. (It's been there all along in JavaScript, but it was just never "noticed" or used by most until...
5
by: Marc | last post by:
I'm aware that there are significant differences between VBScript objects and JScript objects but that doesn't mean something like the following should give me such troubles? <%@...
23
by: dhtmlkitchen | last post by:
JSON We all know what it is. In ECMAScript 4, there's a JSON proposal: Object.prototype.toJSONString String.prototype.parseJSON The current proposal, String.prototype.parseJSON, returns...
9
by: Jon Paal [MSMD] | last post by:
using json like ( {"Records": , "RecordCount":"1" } ) and jquery like: $.ajax({ .... success: function(json, status) {
6
by: Lasse Reichstein Nielsen | last post by:
Max <adsl@tiscali.itwrites: Not really. It shows that a particularly naïve implementation of a conversion from XML to JSON doesn't work well. What if the conversion of <e> some
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.