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

Messages

Advanced
Messages Help
Messages 340 - 370 of 1955   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#340 From: json@yahoogroups.com
Date: Fri May 5, 2006 3:56 pm
Subject: New poll for json
json@yahoogroups.com
Send Email Send Email
 
Enter your vote today!  A new poll has been created for the
json group:

Which of the following data communication methods do you use ?

   o JSON . [Object notation / serialization].
   o XML.
   o Other object serialization.
   o None.


To vote, please visit the following web page:
http://groups.yahoo.com/group/json/surveys?id=1576746

Note: Please do not reply to this message. Poll votes are
not collected via email. To vote, you must go to the Yahoo! Groups
web site listed above.

Thanks!

#341 From: Nic <nferrier@...>
Date: Fri May 5, 2006 7:06 pm
Subject: Re: New poll for json
nicferrier2000
Send Email Send Email
 
This is a silly poll. You can only select one of the options and I
want to select three of them.


Nic

#342 From: "Douglas Crockford" <douglas@...>
Date: Tue May 9, 2006 1:26 am
Subject: JSON Tools
douglascrock...
Send Email Send Email
 
There is an interesting new Java implementation at
http://developer.berlios.de/projects/jsontools/

#343 From: "Mert Sakarya" <mertsakarya@...>
Date: Tue May 23, 2006 8:37 am
Subject: JSDL (Javascript Service Definition Language)
mertsakarya
Send Email Send Email
 
Lately I've been coding with Javascript and JSON a lot. I'am using
XHConn.js (downloadable from http://xkr.us/code/javascript/XHConn/)
as XmlHttpRequest object which is quite small and efficient.

I've noticed that it might be a good practice to move or copy the
business/application layer to the client side (basically some HTML
file). I've modified XHConn (XmlHttpRequest) a little, to use client-
side caching, work both synchronously and asynchronously and return
JSON objects only (currently it is using eval function for
performance). The thing, I like about using "eval" is, you can
create function properties.

Assume that you have a service that works just like a web service,
but this one talks only JSON and works on Web pages over HTTP
(narrowed down the platform). JSON objects are results of our
WebMethods which are callable through XmlHttpRequests. If we can
group these methods in a service in a logical way, we
get "Javascript Services". So we need something like WSDL to combine
these methods. They should contain the definitions of the methods
(the body of the method is a XmlHttpRequest to the server),
parameter validation and some very light error checking (eg. if a
parameter can be null or the max length of parameter etc.). I call
this concept JSDL (Javascript Service Definition Language). The good
thing is, JSDL is itself written with Javascript and actually can be
a JSON object (if we are allowed to add functions to JSON standard).
In Javascript Services we can define functions like below;

function GetCustomer(custId) {
    if(!custId) throw "CUSTID null";
    return (new XHConn()).connect("URL", "GET", "Parameters", null);
}

or async version;

function GetCustomerAsync(custId, asyncCallback) {
    if(!custId) throw "CUSTID null";
    (new XHConn()).connect("URL", "GET", "Parameters", asyncCallback);
}

Now assume that we combine these method definitions in a JSON Object;

Service.jsdl file
------------------------------------------------------------------
{
   "GetCustomer" : function(custId) {
      if(!custId) throw "CUSTID null";
      return (new XHConn()).connect("URL", "GET", "Parameters", null);
   }

   "GetCustomerAsync" : function(custId, asyncCallback) {
      if(!custId) throw "CUSTID null";
      (new XHConn()).connect("URL", "GET", "Parameters",
asyncCallback);
   }
}

As long as "Service.jsdl" file is a JSON object, it can be
downloaded with XmlHttpRequest and be named as a service.

//Synchronous version;
try {
   var service = (new XHConn()).connect("Service.jsdl", "GET", "",
null);
   var customer = service.GetCustomer("CustId");
} catch(e) {
   alert(e);
}

//Asynchronous version;
try
{
   //probably we need to load the service synchronously
   var service = (new XHConn()).connect("Service.jsdl", "GET", "", );
   var customer;
   service.GetCustomerAsync("CustId",
     function(jsonObj) {
       customer = jsonObj;
     }
   );
}
catch(e)
{
   alert(e);
}

All you need is to figure out a way to generate JSDL files on the
server-side just like WSDL files are generated may be something
like, attribute based programming on .Net.

I've got a working copy of this idea in a zip file, but i think
attachments are not allowed here. Wait till I can upload it to the
internet or I can gladly mail it individually.

I've created a server-side solution for this(Javascript Sevices and
JSDL), but it is another long story (may be I'll post it on some
other mail) and covers a lot of other issues (eg. using MSMQ, RSS
generation, Logging, Caching etc). JSDL is only a small part of it.
It is called MS.Services and can be downloded from gotdotnet.com.

Best regards,
Mert Sakarya

#344 From: "Marco Rosella" <marcorosella@...>
Date: Tue May 23, 2006 2:39 pm
Subject: mixed content and attributes
marcorosella
Send Email Send Email
 
Hi all,
i'm new in the JSON world and I'm searching in it a good alternative
to XML.
To begin, I translated some XML data in JSON format, and I crashed
soon with two doubts: mixed content and attributes.

About the first, it related about a XML document like this:

<book>
<chapter>Content of the first chapter</chapter>
<chapter>Content of the first chapter
      <chapter>Content of the first subchapter</chapter>
      <chapter>Content of the second subchapter</chapter>
</chapter>
<chapter>Third Chapter</chapter>
</book>

I would to the light over the second 'chapter' node element
that contains both elements (the child 'chapter') and text ('Content
of...' etc).
W3C called the content of this elements 'mixed content' (XML Schema
Rec.: http://www.w3.org/TR/xmlschema-0/#mixedContent;
XML Spec.: http://www.w3.org/TR/2000/REC-xml-20001006#sec-mixed-content; )
and I think is very important represent it in a datachange format
remembering that for example XHTML is full of these tags (like
<p>This is <a href="http://">a link</a>, yeah</p>).
Searching for a translation way in the JSON site's example page,
my goal failed because I found only element that contains OR elements OR
  character data.
Do you know, so, a way to describe a mixed content in JSON?

The other doubt is about attributes.

In the second example in JSON site's example page
an XML document like this:
<menu id="file" value="File" >
   <popup>
     <menuitem value="New" onclick="CreateNewDoc()" />
     <menuitem value="Open" onclick="OpenDoc()" />
     <menuitem value="Close" onclick="CloseDoc()" />
   </popup>
</menu>

is translated in this way:

{"menu": {
   "id": "file",
   "value": "File:",
   "popup": {
     "menuitem": [
       {"value": "New", "onclick": "CreateNewDoc()"},
       {"value": "Open", "onclick": "OpenDoc()"},
       {"value": "Close", "onclick": "CloseDoc()"}
     ]
   }
As I understand, the attributes are represented at the same level of
the first child.
So I don't find differences in re-translate the JSON format in XML in
this way:

<menu>
   <id>file</id>
   <value>File</value>
   <popup>
     <menuitem value="New" onclick="CreateNewDoc()" />
     <menuitem value="Open" onclick="OpenDoc()" />
     <menuitem value="Close" onclick="CloseDoc()" />
   </popup>
</menu>

Lost attribute power (a sort of "semanthic enrichment" of the element,
not a child of this) is like to represented an HTML div like this:
	 <div class="ciao"/>
in this way:
	 <div>
	   <class>ciao</class>
	 </div>

To confirm if I'm wrong or not, I'll cut'n'paste the third example
taken from the same page:

{"widget": {
     "debug": "on",
     "window": {
         "title": "Sample Konfabulator Widget",
         "name": "main_window",
         "width": 500,
         "height": 500
     },
     "image": {
         "src": "Images/Sun.png",
         "name": "sun1",
         "hOffset": 250,
         "vOffset": 250,
         "alignment": "center"
     },
     "text": {
         "data": "Click Here",
         "size": 36,
         "style": "bold",
         "name": "text1",
         "hOffset": 250,
         "vOffset": 100,
         "alignment": "center",
         "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
     }
}}

The same text expressed as XML:

<widget>
     <debug>on</debug>
     <window title="Sample Konfabulator Widget">
         <name>main_window</name>
         <width>500</width>
         <height>500</height>
     </window>
     <image src="Images/Sun.png" name="sun1">
         <hOffset>250</hOffset>
         <vOffset>250</vOffset>
         <alignment>center</alignment>
     </image>
     <text data="Click Here" size="36" style="bold">
         <name>text1</name>
         <hOffset>250</hOffset>
         <vOffset>100</vOffset>
         <alignment>center</alignment>
         <onMouseUp>
             sun1.opacity = (sun1.opacity / 100) * 90;
         </onMouseUp>
     </text>
</widget>

Where is written that ONLY the name/value pair with the name "title"
can be an attribute of 'window' element?
Why the 'image' element has as attribute 'src' and 'name'
and not 'hOffset' or 'vOffset' too?

Thanks for your patience long like this email! :)

-----------------------------------
Marco Rosella
http://www.centralscrutinizer.it/en

#345 From: "Douglas Crockford" <douglas@...>
Date: Tue May 23, 2006 2:50 pm
Subject: Re: mixed content and attributes
douglascrock...
Send Email Send Email
 
> About the first, it related about a XML document like this:
>
> <book>
> <chapter>Content of the first chapter</chapter>
> <chapter>Content of the first [sic] chapter
>      <chapter>Content of the first subchapter</chapter>
>      <chapter>Content of the second subchapter</chapter>
> </chapter>
> <chapter>Third Chapter</chapter>
> </book>

There are many ways that you could render that into JSON. This is how
org.json.XML does it in Java:

{"book": {"chapter": [
     "Content of the first chapter",
     {
         "content": "Content of the first [sic] chapter",
         "chapter": [
             "Content of the first subchapter",
             "Content of the second subchapter"
         ]
     },
     "Third Chapter"
]}}

#346 From: "Mert Sakarya" <msakarya@...>
Date: Tue May 23, 2006 3:33 pm
Subject: Introduction Date and Function objects to the standard
mertsakarya
Send Email Send Email
 
Can we use function definitions in JSON? Eg.

{"book": {
	 "name": "bookname",
	 "chapter": [...],
	 "gotoChapter" : function(chapterId) {...}
	 }
}

And how about using Date objects? Eg.

{"book": {
	 "name": "bookname",
	 "chapter": [...],
	 "gotoChapter" : function(chapterId) {...},
	 "printDate" : new Date(2000,06,31,12,11,00)
	 }
}

The two examples above cannot be parsed, "parse" method on the standard.

I think, adding function definitions to the standard, adds great
flexibility for javascript, but decreases portability.

#347 From: "Martin Cooper" <mfncooper@...>
Date: Tue May 23, 2006 4:07 pm
Subject: Re: Introduction Date and Function objects to the standard
mfncooper
Send Email Send Email
 
On 5/23/06, Mert Sakarya <msakarya@...> wrote:
>
> Can we use function definitions in JSON?


Please, no! That violates just about everything JSON is about. If you want
to pass functions around, just use JavaScript in the first place, and forget
about JSON.

--
Martin Cooper


Eg.
>
> {"book": {
>         "name": "bookname",
>         "chapter": [...],
>         "gotoChapter" : function(chapterId) {...}
>         }
> }
>
> And how about using Date objects? Eg.
>
> {"book": {
>         "name": "bookname",
>         "chapter": [...],
>         "gotoChapter" : function(chapterId) {...},
>         "printDate" : new Date(2000,06,31,12,11,00)
>         }
> }
>
> The two examples above cannot be parsed, "parse" method on the standard.
>
> I think, adding function definitions to the standard, adds great
> flexibility for javascript, but decreases portability.
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


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

#348 From: "Martin Cooper" <mfncooper@...>
Date: Tue May 23, 2006 4:14 pm
Subject: Re: JSDL (Javascript Service Definition Language)
mfncooper
Send Email Send Email
 
You might want to look at the Dojo toolkit. It already has a JSDL
implementation that it uses along with its JsonService class for JSON-based
remote calls.

--
Martin Cooper


On 5/23/06, Mert Sakarya <mertsakarya@...> wrote:
>
> Lately I've been coding with Javascript and JSON a lot. I'am using
> XHConn.js (downloadable from http://xkr.us/code/javascript/XHConn/)
> as XmlHttpRequest object which is quite small and efficient.
>
> I've noticed that it might be a good practice to move or copy the
> business/application layer to the client side (basically some HTML
> file). I've modified XHConn (XmlHttpRequest) a little, to use client-
> side caching, work both synchronously and asynchronously and return
> JSON objects only (currently it is using eval function for
> performance). The thing, I like about using "eval" is, you can
> create function properties.
>
> Assume that you have a service that works just like a web service,
> but this one talks only JSON and works on Web pages over HTTP
> (narrowed down the platform). JSON objects are results of our
> WebMethods which are callable through XmlHttpRequests. If we can
> group these methods in a service in a logical way, we
> get "Javascript Services". So we need something like WSDL to combine
> these methods. They should contain the definitions of the methods
> (the body of the method is a XmlHttpRequest to the server),
> parameter validation and some very light error checking (eg. if a
> parameter can be null or the max length of parameter etc.). I call
> this concept JSDL (Javascript Service Definition Language). The good
> thing is, JSDL is itself written with Javascript and actually can be
> a JSON object (if we are allowed to add functions to JSON standard).
> In Javascript Services we can define functions like below;
>
> function GetCustomer(custId) {
>    if(!custId) throw "CUSTID null";
>    return (new XHConn()).connect("URL", "GET", "Parameters", null);
> }
>
> or async version;
>
> function GetCustomerAsync(custId, asyncCallback) {
>    if(!custId) throw "CUSTID null";
>    (new XHConn()).connect("URL", "GET", "Parameters", asyncCallback);
> }
>
> Now assume that we combine these method definitions in a JSON Object;
>
> Service.jsdl file
> ------------------------------------------------------------------
> {
>   "GetCustomer" : function(custId) {
>      if(!custId) throw "CUSTID null";
>      return (new XHConn()).connect("URL", "GET", "Parameters", null);
>   }
>
>   "GetCustomerAsync" : function(custId, asyncCallback) {
>      if(!custId) throw "CUSTID null";
>      (new XHConn()).connect("URL", "GET", "Parameters",
> asyncCallback);
>   }
> }
>
> As long as "Service.jsdl" file is a JSON object, it can be
> downloaded with XmlHttpRequest and be named as a service.
>
> //Synchronous version;
> try {
>   var service = (new XHConn()).connect("Service.jsdl", "GET", "",
> null);
>   var customer = service.GetCustomer("CustId");
> } catch(e) {
>   alert(e);
> }
>
> //Asynchronous version;
> try
> {
>   //probably we need to load the service synchronously
>   var service = (new XHConn()).connect("Service.jsdl", "GET", "", );
>   var customer;
>   service.GetCustomerAsync("CustId",
>     function(jsonObj) {
>       customer = jsonObj;
>     }
>   );
> }
> catch(e)
> {
>   alert(e);
> }
>
> All you need is to figure out a way to generate JSDL files on the
> server-side just like WSDL files are generated may be something
> like, attribute based programming on .Net.
>
> I've got a working copy of this idea in a zip file, but i think
> attachments are not allowed here. Wait till I can upload it to the
> internet or I can gladly mail it individually.
>
> I've created a server-side solution for this(Javascript Sevices and
> JSDL), but it is another long story (may be I'll post it on some
> other mail) and covers a lot of other issues (eg. using MSMQ, RSS
> generation, Logging, Caching etc). JSDL is only a small part of it.
> It is called MS.Services and can be downloded from gotdotnet.com.
>
> Best regards,
> Mert Sakarya
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


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

#349 From: "Greg Patnude" <gpatnude@...>
Date: Tue May 23, 2006 4:22 pm
Subject: Re: Introduction Date and Function objects to the standard
gregpatnude
Send Email Send Email
 
You know Mert -- I think you are on to something here but I have to
suggest an alternative to your implementation -- I personally can't
readily accept a situation where every time the language changes -- I
would need to update the JSON parser and redeploy it to my server(s) --
I think a better approach would be for the JavaScript version (let's
call it the "runtime" or the "client-side parser") of the JSON parser to
server as a wrapper around the JavaScript core objects. This makes sense
for a lot of reasons, including:

     * Automatic forward compatibility as the ECMA standard evolves and
the JavaScript interpreters evolve
     * Native support for ALL JavaScript "types", including the
troublesome JavaScript "Date" type. If you look closely at the "Date"
type -- you will see that it is more object than variable -- in fact --
it is a composite object, encapsulating strings, numbers, and functions
(methods) -- this is why you can't really parse a native date in the
core JSON
     * This would implement your idea of incorporating a stringified
function definition into a callable function

I wouldn't really suggest throwing out the baby with the bathwater --
the JSON parser developed by Doug Crockford is excellent -- but I would
suggest some restructuring -- this is a somewhat major and radical
solution but it would be a "one-time" restructuring --

My suggestion would be to blend the JSON tokenizer with a loop iterator.
Fundamentally -- the JSON parser loops through the stringified object
and then iterates through the native JavaScript "types" --  the goal of
the improved parser is to cast the stringified data into a JavaScript
native type...




--- In json@yahoogroups.com, "Mert Sakarya" <msakarya@...> wrote:
>
> Can we use function definitions in JSON? Eg.
>
> {"book": {
> "name": "bookname",
> "chapter": [...],
> "gotoChapter" : function(chapterId) {...}
> }
> }
>
> And how about using Date objects? Eg.
>
> {"book": {
> "name": "bookname",
> "chapter": [...],
> "gotoChapter" : function(chapterId) {...},
> "printDate" : new Date(2000,06,31,12,11,00)
> }
> }
>
> The two examples above cannot be parsed, "parse" method on the
standard.
>
> I think, adding function definitions to the standard, adds great
> flexibility for javascript, but decreases portability.
>




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

#350 From: "neil_b" <neil@...>
Date: Tue May 23, 2006 9:52 pm
Subject: Classic ASP and T-SQL
neil_b
Send Email Send Email
 
First Post - I see most environments are covered with a library for
json except Classic ASP. I have one last major development to do with
it before moving on to something newer.

I imagine I could simply use Javascript mixed in with whatever other
scripting languages I use (VBScript and ActivePerl). Does anyone have
any guidance, comments or even code to help me with this approach?

I am also interested in creating json with T-SQL in SQL Server.
Comments on that are appreciated too.

Neil

#351 From: Fang Yidong <fangyidong@...>
Date: Wed May 24, 2006 1:45 am
Subject: Re: Introduction Date and Function objects to the standard
fangyidong
Send Email Send Email
 
I think why JSON be successful as a data-interchange
format is its simplicity and neutral nature for many
languages. Adding function definition just make JSON
stick to javascript. As to the datatype 'Date',you can
use number or string to represent it.

--- Mert Sakarya <msakarya@...>:

> Can we use function definitions in JSON? Eg.
>
> {"book": {
>  "name": "bookname",
>  "chapter": [...],
>  "gotoChapter" : function(chapterId) {...}
>  }
> }
>
> And how about using Date objects? Eg.
>
> {"book": {
>  "name": "bookname",
>  "chapter": [...],
>  "gotoChapter" : function(chapterId) {...},
>  "printDate" : new Date(2000,06,31,12,11,00)
>  }
> }
>
> The two examples above cannot be parsed, "parse"
> method on the standard.
>
> I think, adding function definitions to the
> standard, adds great
> flexibility for javascript, but decreases
> portability.
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Home is just a click away.  Make Yahoo! your home
> page now.
>
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/1U_rlB/TM
>
--------------------------------------------------------------------~->
>
>
>
> Yahoo! Groups Links
>
>
>     json-unsubscribe@yahoogroups.com
>
>
>
>
>




___________________________________________________________
ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ
http://cn.mail.yahoo.com/

#352 From: "Atif Aziz" <atif.aziz@...>
Date: Wed May 24, 2006 7:36 am
Subject: RE: JSDL (Javascript Service Definition Language)
azizatif
Send Email Send Email
 
Mert, it seems to me that what you are proposing here is rather a
JavaScript service proxy than a description language. A description
language would be just that, a description to be interpreted by a
receiving party (without implementation details embedded as JS
functions).

As Martin already pointed out, someone over at Dojo has come up with SMD
[1], but I think it's rather too simple and experimental right now. I
added SMD support to Jayrock [2] some time back if you want to check it
out. As for something like JSDL that you're proposing, you might want to
check out how Jayrock does something similar already via dynamic proxy
generation for the client. For a live demo, try this on your
terminal/console:

wget -O - http://www.raboof.com/Projects/Jayrock/Demo.ashx?proxy

I've also worked towards an implementation-independent proxy that allows
a service exposed via Jayrock to be called over any channel and
client-side AJAX toolkit (be that YUI connection, Dojo, Atlas or your
own home-grown stuff). You can get a crack at this by appending v=2 to
the query component of the URL, as in:

http://www.raboof.com/Projects/Jayrock/Demo.ashx?proxy&v=2

The difference you'll see with the latter is that the proxy never makes
the call or bears any implementation details about XmlHttpRequest. It
simply prepares a call object that can be serialized and shipped over
some arbitrary channel implementation.

Finally, I'm working on the JSON-RPC 1.1 specification where one of the
goals is to come up with a standard description language. If you're
interested, hop over to http://groups.yahoo.com/group/json-rpc/ and see
threads related to the 1.1 working draft (subject line is usually
prefixed with "1.1WD"). You're feedback on what what's coming up in 1.1
and how would be appreciated.

- Atif

[1] http://dojo.jot.com/SMD
[2] http://blog.dojotoolkit.org/2006/03/11/jayrock-implements-smd
[3]
http://developer.berlios.de/feature/index.php?func=detailfeature&feature
_id=1890&group_id=4638
[3] http://www.raboof.com/Projects/Jayrock/Demo.ashx?proxy

-----Original Message-----
From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of
Mert Sakarya
Sent: Tuesday, May 23, 2006 10:38 AM
To: json@yahoogroups.com
Subject: [json] JSDL (Javascript Service Definition Language)

Lately I've been coding with Javascript and JSON a lot. I'am using
XHConn.js (downloadable from http://xkr.us/code/javascript/XHConn/)
as XmlHttpRequest object which is quite small and efficient.

I've noticed that it might be a good practice to move or copy the
business/application layer to the client side (basically some HTML
file). I've modified XHConn (XmlHttpRequest) a little, to use client-
side caching, work both synchronously and asynchronously and return
JSON objects only (currently it is using eval function for
performance). The thing, I like about using "eval" is, you can
create function properties.

Assume that you have a service that works just like a web service,
but this one talks only JSON and works on Web pages over HTTP
(narrowed down the platform). JSON objects are results of our
WebMethods which are callable through XmlHttpRequests. If we can
group these methods in a service in a logical way, we
get "Javascript Services". So we need something like WSDL to combine
these methods. They should contain the definitions of the methods
(the body of the method is a XmlHttpRequest to the server),
parameter validation and some very light error checking (eg. if a
parameter can be null or the max length of parameter etc.). I call
this concept JSDL (Javascript Service Definition Language). The good
thing is, JSDL is itself written with Javascript and actually can be
a JSON object (if we are allowed to add functions to JSON standard).
In Javascript Services we can define functions like below;

function GetCustomer(custId) {
    if(!custId) throw "CUSTID null";
    return (new XHConn()).connect("URL", "GET", "Parameters", null);
}

or async version;

function GetCustomerAsync(custId, asyncCallback) {
    if(!custId) throw "CUSTID null";
    (new XHConn()).connect("URL", "GET", "Parameters", asyncCallback);
}

Now assume that we combine these method definitions in a JSON Object;

Service.jsdl file
------------------------------------------------------------------
{
   "GetCustomer" : function(custId) {
      if(!custId) throw "CUSTID null";
      return (new XHConn()).connect("URL", "GET", "Parameters", null);
   }

   "GetCustomerAsync" : function(custId, asyncCallback) {
      if(!custId) throw "CUSTID null";
      (new XHConn()).connect("URL", "GET", "Parameters",
asyncCallback);
   }
}

As long as "Service.jsdl" file is a JSON object, it can be
downloaded with XmlHttpRequest and be named as a service.

//Synchronous version;
try {
   var service = (new XHConn()).connect("Service.jsdl", "GET", "",
null);
   var customer = service.GetCustomer("CustId");
} catch(e) {
   alert(e);
}

//Asynchronous version;
try
{
   //probably we need to load the service synchronously
   var service = (new XHConn()).connect("Service.jsdl", "GET", "", );
   var customer;
   service.GetCustomerAsync("CustId",
     function(jsonObj) {
       customer = jsonObj;
     }
   );
}
catch(e)
{
   alert(e);
}

All you need is to figure out a way to generate JSDL files on the
server-side just like WSDL files are generated may be something
like, attribute based programming on .Net.

I've got a working copy of this idea in a zip file, but i think
attachments are not allowed here. Wait till I can upload it to the
internet or I can gladly mail it individually.

I've created a server-side solution for this(Javascript Sevices and
JSDL), but it is another long story (may be I'll post it on some
other mail) and covers a lot of other issues (eg. using MSMQ, RSS
generation, Logging, Caching etc). JSDL is only a small part of it.
It is called MS.Services and can be downloded from gotdotnet.com.

Best regards,
Mert Sakarya








Yahoo! Groups Links

#353 From: Lindsay <lindsay@...>
Date: Thu May 25, 2006 11:35 pm
Subject: Re: Introduction Date and Function objects to the standard
softlog_lindsay
Send Email Send Email
 
Fang Yidong wrote:
> I think why JSON be successful as a data-interchange
> format is its simplicity and neutral nature for many
> languages. Adding function definition just make JSON
> stick to javascript. As to the datatype 'Date',you can
> use number or string to represent it.
>

Agreed. Maybe define a std date format, there's a ISO one which would do
fine.


--
Lindsay

#354 From: "Greg Patnude" <gpatnude@...>
Date: Fri May 26, 2006 3:25 pm
Subject: Re: Introduction Date and Function objects to the standard [DATE PARSER]
gregpatnude
Send Email Send Email
 
I have a JSON compatible date parser which converts a stringified
version of a C-Type date (mm-dd-yyyy hh:mm:ss.nnnn [AM:PM]) into a
JavaScript native Date object format...

I will offer it to the JSON community to be included as a component of
the json.js library -- provided under the JSON License (Doug's "Good
NOT Evil" license)...

Speaking of the "Good NOT Evil" license -- is anyone interested in
formalizing that ? like the myriad licensing already available -- GPL,
or LGPL, or BSD Licenses...  we could call it the "GNOTE" license....


--- In json@yahoogroups.com, Lindsay <lindsay@...> wrote:
>
> Fang Yidong wrote:
> > I think why JSON be successful as a data-interchange
> > format is its simplicity and neutral nature for many
> > languages. Adding function definition just make JSON
> > stick to javascript. As to the datatype 'Date',you can
> > use number or string to represent it.
> >
>
> Agreed. Maybe define a std date format, there's a ISO one which
would do
> fine.
>
>
> --
> Lindsay
>

#355 From: "Greg Patnude" <gpatnude@...>
Date: Fri May 26, 2006 3:33 pm
Subject: Re: Introduction Date and Function objects to the standard
gregpatnude
Send Email Send Email
 
I think everyone is missing teh point I am trying to make --- I truly
believe that "Object Notation" is the holy grail of data interchange.
As a result, I would like to see object notation extended beyond just
support for JavaScript (JSON) to every language --

If we are truly talking about Object Notation -- then the parser(s)
need to support all of the native object types for any given
programming language -- If we are only talking about JavaScript
Object Notation -- then I would expect the parser(s) to support all
of the object / data types native to JavaScript.

So -- if JSON is to TRULY represent the JavaScript Objects -- in
addition to String, Number, Array, Object, true, false, and null
objects -- the parser should also necessarily include

• Date
• Math
• Function
• RegExp
and
• Boolean objects...

My desire is to see object notation become mainstream -- much more
than JSON and bigger than XML even -- In order to accomplish that --
we would really need an object notation parser for every language
that is to be supported -- the purpose of the parser(s) would be to
convert the object notation format to and from native language
objects (NLO's) and variable data types...

So, in a JavaScript implementation -- the parser would support all of
the JavaScript core data types: OBject, Array, Function, String,
Date, Number, etc...

In a VBScript implementation: the parser would support Variant,
String, Number, Array, etc...

You get the idea -- basically -- I am proposing a "type-mapping"
mechanism and wrappers that support a language independent
implementation of object-notation


--- In json@yahoogroups.com, Lindsay <lindsay@...> wrote:
>
> Fang Yidong wrote:
> > I think why JSON be successful as a data-interchange
> > format is its simplicity and neutral nature for many
> > languages. Adding function definition just make JSON
> > stick to javascript. As to the datatype 'Date',you can
> > use number or string to represent it.
> >
>
> Agreed. Maybe define a std date format, there's a ISO one which
would do
> fine.
>
>
> --
> Lindsay
>

#356 From: "Martin Cooper" <mfncooper@...>
Date: Fri May 26, 2006 4:31 pm
Subject: Re: Re: Introduction Date and Function objects to the standard [DATE PARSER]
mfncooper
Send Email Send Email
 
On 5/26/06, Greg Patnude <gpatnude@...> wrote:
>
> I have a JSON compatible date parser which converts a stringified
> version of a C-Type date (mm-dd-yyyy hh:mm:ss.nnnn [AM:PM]) into a
> JavaScript native Date object format...


Why the C format? Why not base it on the ISO standard, if we have to include
dates in JSON? And if the above format actually defines what you have, then
how would I specify the time zone? Or is it assumed to be UTC?

I will offer it to the JSON community to be included as a component of
> the json.js library -- provided under the JSON License (Doug's "Good
> NOT Evil" license)...
>
> Speaking of the "Good NOT Evil" license -- is anyone interested in
> formalizing that ? like the myriad licensing already available -- GPL,
> or LGPL, or BSD Licenses...  we could call it the "GNOTE" license....


No, no, no! There are already dozens and dozens of open source licenses.
There is absolutely no good reason to invent another one. Do you have any
idea how much legal crap creating a new license creates for any company or
other organisation that actually wants to use the associated software? If
you want to formalise the license, please, please pick one of these:

http://www.opensource.org/licenses/

I'd suggest the Apache License 2.0, which pretty much says you can do
whatever you want with the software as long as you keep the original license
in place.

--
Martin Cooper


--- In json@yahoogroups.com, Lindsay <lindsay@...> wrote:
> >
> > Fang Yidong wrote:
> > > I think why JSON be successful as a data-interchange
> > > format is its simplicity and neutral nature for many
> > > languages. Adding function definition just make JSON
> > > stick to javascript. As to the datatype 'Date',you can
> > > use number or string to represent it.
> > >
> >
> > Agreed. Maybe define a std date format, there's a ISO one which
> would do
> > fine.
> >
> >
> > --
> > Lindsay
> >
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


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

#357 From: Christopher Stumm <christopher@...>
Date: Fri May 26, 2006 4:43 pm
Subject: Re: Re: Introduction Date and Function objects to the standard [DATE PARSER]
christopher....
Send Email Send Email
 
On 26 May, 2006, at 12:31, Martin Cooper wrote:

>  On 5/26/06, Greg Patnude <gpatnude@...> wrote:
>  >
>  > I have a JSON compatible date parser which converts a stringified
>  > version of a C-Type date (mm-dd-yyyy hh:mm:ss.nnnn [AM:PM]) into a
>  > JavaScript native Date object format...
>
>  Why the C format? Why not base it on the ISO standard, if we have to
> include
>  dates in JSON? And if the above format actually defines what you
> have, then
>  how would I specify the time zone? Or is it assumed to be UTC?

Maybe I'm missing something, but why wouldn't one simply use the
standard
unix time? It does not rely on time-zones (which people seem to largely
ignore
on the internet), and is likely supported already by most languages, JS
included.
In addition it can easily be sent around as a simple int.

	 -Christopher

#358 From: Dave Balmer <dbalmer@...>
Date: Fri May 26, 2006 7:10 pm
Subject: Re: Re: Introduction Date and Function objects to the standard
dbalmerjr
Send Email Send Email
 
Greg,

I've given this a bit of thought too, but in the end this would only
complicate matters exponentially. Making a simple data parser is one
thing, but adding in a language parser (much less many language
parsers) on top of that just isn't practical.

Taking this "next logical step" would in fact narrow JSON's use as a
lightweight data exchange format, and limit adoption.

There's nothing which says you can't rig something (there are several
applications which abuse CDATA in XML to introduce in-line code, for
example), but I see no value in adding it to the specs.

Dave


On May 26, 2006, at 8:33 AM, Greg Patnude wrote:

> I think everyone is missing teh point I am trying to make --- I truly
> believe that "Object Notation" is the holy grail of data interchange.
> As a result, I would like to see object notation extended beyond just
> support for JavaScript (JSON) to every language --
>
> If we are truly talking about Object Notation -- then the parser(s)
> need to support all of the native object types for any given
> programming language -- If we are only talking about JavaScript
> Object Notation -- then I would expect the parser(s) to support all
> of the object / data types native to JavaScript.
>
> So -- if JSON is to TRULY represent the JavaScript Objects -- in
> addition to String, Number, Array, Object, true, false, and null
> objects -- the parser should also necessarily include
>
> • Date
> • Math
> • Function
> • RegExp
> and
> • Boolean objects...
>
> My desire is to see object notation become mainstream -- much more
> than JSON and bigger than XML even -- In order to accomplish that --
> we would really need an object notation parser for every language
> that is to be supported -- the purpose of the parser(s) would be to
> convert the object notation format to and from native language
> objects (NLO's) and variable data types...
>
> So, in a JavaScript implementation -- the parser would support all of
> the JavaScript core data types: OBject, Array, Function, String,
> Date, Number, etc...
>
> In a VBScript implementation: the parser would support Variant,
> String, Number, Array, etc...
>
> You get the idea -- basically -- I am proposing a "type-mapping"
> mechanism and wrappers that support a language independent
> implementation of object-notation
>
>
> --- In json@yahoogroups.com, Lindsay <lindsay@...> wrote:
> >
> > Fang Yidong wrote:
> > > I think why JSON be successful as a data-interchange
> > > format is its simplicity and neutral nature for many
> > > languages. Adding function definition just make JSON
> > > stick to javascript. As to the datatype 'Date',you can
> > > use number or string to represent it.
> > >
> >
> > Agreed. Maybe define a std date format, there's a ISO one which
> would do
> > fine.
> >
> >
> > --
> > Lindsay
> >
>
>

---
"Mean people suck." -- unknown

#359 From: "Mert Sakarya" <mertsakarya@...>
Date: Fri May 26, 2006 8:25 pm
Subject: Using JSON with eval in Javascript
mertsakarya
Send Email Send Email
 
Hello everyone,

I've got another question. I love JSON and the idea behind it. It is cool and
generic.

I am using JSON, with Javascript on the client-side with XmlHttpRequest, but
instead of parsing the object with the "parseJSON" method in the "json.js" coded
at json.org,  I am parsing it with the "eval" (the evil) function of javascript.
This way it is parsed faster and have the ability to use the extended javascript
features in generated output (eg, ability to add function). Now, the question
is, can I say I am using JSON or not?

Regards,
Mert
_________________________________________________________________
Join the next generation of Hotmail and you could win the adventure of a
lifetime
http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx

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

#360 From: MPCM <WickedLogic@...>
Date: Fri May 26, 2006 8:51 pm
Subject: Re: Using JSON with eval in Javascript
mpcmtechnolo...
Send Email Send Email
 
If you say just JSON, people will assume that you are talking about the
current spec. I'm guessing most people use eval at least on the Javascript
side.

If you extend it, you've simple wandered away from the spec both in your
encoding and possibly decoding to make it work. I'd worry more about what
your doing with it, rather than what you get to call it. Calling it json vs.
`json that I've extended` will only come up when you misrepresent what your
using and it concerns others.

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


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

#361 From: "Greg Patnude" <gpatnude@...>
Date: Fri May 26, 2006 8:55 pm
Subject: Re: Introduction Date and Function objects to the standard [DATE PARSER]
gregpatnude
Send Email Send Email
 
It is originally based on converting a date-time string from an ANSI
SQL database into a JavaScript UTC time... The ANSI SQL datetime
(timestamp) appeared to be "closest to" the JavaScript Date()
constructor at the time I developed the library --

var dt = new Date("mm-dd-yy hh:mm:ss.ms");


Since 99.999% of the dates / times I display in the UI come from the
RDBMS -- this also made a lot of sense at the time....

RE: Unix date / time -- not everyone is into Unix... many people
appear to be using PHP, Perl, and ASP... Personally -- if it were
100% Unix / C / Java / ANSI SQL types -- I would be a happy camper...
but... we gotta provide support for the greatest common
denominator... not the lowest common denominator...



--- In json@yahoogroups.com, Christopher Stumm <christopher@...>
wrote:
>
> On 26 May, 2006, at 12:31, Martin Cooper wrote:
>
> >  On 5/26/06, Greg Patnude <gpatnude@...> wrote:
> >  >
> >  > I have a JSON compatible date parser which converts a
stringified
> >  > version of a C-Type date (mm-dd-yyyy hh:mm:ss.nnnn [AM:PM])
into a
> >  > JavaScript native Date object format...
> >
> >  Why the C format? Why not base it on the ISO standard, if we
have to
> > include
> >  dates in JSON? And if the above format actually defines what you
> > have, then
> >  how would I specify the time zone? Or is it assumed to be UTC?
>
> Maybe I'm missing something, but why wouldn't one simply use the
> standard
> unix time? It does not rely on time-zones (which people seem to
largely
> ignore
> on the internet), and is likely supported already by most
languages, JS
> included.
> In addition it can easily be sent around as a simple int.
>
>  -Christopher
>

#362 From: Fang Yidong <fangyidong@...>
Date: Sat May 27, 2006 4:12 am
Subject: Re: Re: Introduction Date and Function objects to the standard [DATE PARSER]
fangyidong
Send Email Send Email
 
It's not necessary to add Date SPEC to JSON to make
things work. JSON just give you the freedom to do
whatever you want.

I've used JSON.simple to exchange millions of records
contains date and time fields from Oracle to
Postgres,it works very well and just 2 or 3 lines
added to convert the date and time format between
Oracle and Postgres,without the Date SPEC.

So I think the core primitive datetype
String,True,False,Number and Null of JSON is enough.

--- Greg Patnude <gpatnude@...>:

> It is originally based on converting a date-time
> string from an ANSI
> SQL database into a JavaScript UTC time... The ANSI
> SQL datetime
> (timestamp) appeared to be "closest to" the
> JavaScript Date()
> constructor at the time I developed the library --
>
> var dt = new Date("mm-dd-yy hh:mm:ss.ms");
>
>
> Since 99.999% of the dates / times I display in the
> UI come from the
> RDBMS -- this also made a lot of sense at the
> time....
>
> RE: Unix date / time -- not everyone is into Unix...
> many people
> appear to be using PHP, Perl, and ASP... Personally
> -- if it were
> 100% Unix / C / Java / ANSI SQL types -- I would be
> a happy camper...
> but... we gotta provide support for the greatest
> common
> denominator... not the lowest common denominator...
>
>
>
> --- In json@yahoogroups.com, Christopher Stumm
> <christopher@...>
> wrote:
> >
> > On 26 May, 2006, at 12:31, Martin Cooper wrote:
> >
> > >  On 5/26/06, Greg Patnude <gpatnude@...> wrote:
> > >  >
> > >  > I have a JSON compatible date parser which
> converts a
> stringified
> > >  > version of a C-Type date (mm-dd-yyyy
> hh:mm:ss.nnnn [AM:PM])
> into a
> > >  > JavaScript native Date object format...
> > >
> > >  Why the C format? Why not base it on the ISO
> standard, if we
> have to
> > > include
> > >  dates in JSON? And if the above format actually
> defines what you
> > > have, then
> > >  how would I specify the time zone? Or is it
> assumed to be UTC?
> >
> > Maybe I'm missing something, but why wouldn't one
> simply use the
> > standard
> > unix time? It does not rely on time-zones (which
> people seem to
> largely
> > ignore
> > on the internet), and is likely supported already
> by most
> languages, JS
> > included.
> > In addition it can easily be sent around as a
> simple int.
> >
> >  -Christopher
> >
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Home is just a click away.  Make Yahoo! your home
> page now.
>
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/1U_rlB/TM
>
--------------------------------------------------------------------~->
>
>
>
> Yahoo! Groups Links
>
>
>     json-unsubscribe@yahoogroups.com
>
>
>
>
>



___________________________________________________________
JSON: Action in AJAX!

JSON - http://www.json.org
JSON.simple - http://www.json.org/java/simple.txt




___________________________________________________________
ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ
http://cn.mail.yahoo.com/

#363 From: "rancioadams" <comomolo@...>
Date: Sat May 27, 2006 4:21 am
Subject: My javascript app freezes at eval'uating JSON string returned
rancioadams
Send Email Send Email
 
Hi everyone. I'm new to this group so I'd like to say hello. My name
is Pablo, despite of the dumb name in my email.

My little AJAX app doesn't like the JSON encoded strings returned from
the PHP part of the app. I mean, the PHP code returns an apparently
correct string and I can see the data if I put the JSON string
directly into the div element, but my javascript hangs if I try to
eval the string. If I create an "identical" string manually, my
javascript evaluates it correctly. This suggests the JSON string
contains unprintable non-eval'able characters. I'm about to give up
and write a little parsing code for this particular need.

Any ideas?

Pablo

PS: When I'm finished with this little job, I might help with the
Spanish translations of the JSON pages.

#364 From: "Atif Aziz" <atif.aziz@...>
Date: Sat May 27, 2006 10:16 am
Subject: RE: Using JSON with eval in Javascript
azizatif
Send Email Send Email
 
> Now, the question is, can I say I am using JSON or not?

It doesn't matter how you parse it but what you put in there that makes it JOSN
or not. So if you use functions, then no, it's not JSON. If, on the other hand,
you pass the functions as JSON strings and then "eval" those strings to import
the functions individually, then technically, you're still doing JSON.

-----Original Message-----
From: json@yahoogroups.com [mailto:json@yahoogroups.com] On Behalf Of Mert
Sakarya
Sent: Friday, May 26, 2006 10:25 PM
To: json@yahoogroups.com
Subject: [json] Using JSON with eval in Javascript

Hello everyone,

I've got another question. I love JSON and the idea behind it. It is cool and
generic.

I am using JSON, with Javascript on the client-side with XmlHttpRequest, but
instead of parsing the object with the "parseJSON" method in the "json.js" coded
at json.org,  I am parsing it with the "eval" (the evil) function of javascript.
This way it is parsed faster and have the ability to use the extended javascript
features in generated output (eg, ability to add function). Now, the question
is, can I say I am using JSON or not?

Regards,
Mert
_________________________________________________________________
Join the next generation of Hotmail and you could win the adventure of a
lifetime
http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx

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





Yahoo! Groups Links

#365 From: Fang Yidong <fangyidong@...>
Date: Sat May 27, 2006 3:48 pm
Subject: Re: My javascript app freezes at eval'uating JSON string returned
fangyidong
Send Email Send Email
 
Show your source code of client side and server side
to us, and maybe we can figure out what the problem
is.

--- rancioadams <comomolo@...>:

> Hi everyone. I'm new to this group so I'd like to
> say hello. My name
> is Pablo, despite of the dumb name in my email.
>
> My little AJAX app doesn't like the JSON encoded
> strings returned from
> the PHP part of the app. I mean, the PHP code
> returns an apparently
> correct string and I can see the data if I put the
> JSON string
> directly into the div element, but my javascript
> hangs if I try to
> eval the string. If I create an "identical" string
> manually, my
> javascript evaluates it correctly. This suggests the
> JSON string
> contains unprintable non-eval'able characters. I'm
> about to give up
> and write a little parsing code for this particular
> need.
>
> Any ideas?
>
> Pablo
>
> PS: When I'm finished with this little job, I might
> help with the
> Spanish translations of the JSON pages.
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> You can search right from your browser? It's easy
> and it's free.  See how.
>
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
>
--------------------------------------------------------------------~->
>
>
>
> Yahoo! Groups Links
>
>
>     json-unsubscribe@yahoogroups.com
>
>
>
>
>



___________________________________________________________
JSON: Action in AJAX!

JSON - http://www.json.org
JSON.simple - http://www.json.org/java/simple.txt




___________________________________________________________
ÇÀ×¢ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ£¡
http://cn.mail.yahoo.com

#367 From: "rancioadams" <comomolo@...>
Date: Sat May 27, 2006 4:40 pm
Subject: Re: My javascript app freezes at eval'uating JSON string returned
rancioadams
Send Email Send Email
 
Here's the server code:
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<?php

require_once('JSON.php');
$json = new Services_JSON();

$con=mysql_connect("xxxxx", "xxxxx", "xxxxx");

if (!$con)
   {
   die('Could not connect: ' . mysql_error());
   }
mysql_select_db("xxxxx", $con);

$subfamilia = utf8_decode($_GET["subfamilia"]);

$sql = "SELECT * FROM equipos WHERE SUBFAMILIA = '$subfamilia'";

$query = mysql_query($sql) or die(mysql_error());

$row = mysql_fetch_row($query);
echo $json->encode($row);

?>

And here's the client code:

function getLista(subfamilia)
{
    var xmlhttp=false;

    try
    {
      xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
    }

    catch (e)
    {
      try
      {
        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
      }
      catch (E)
      {
        xmlhttp = false;
      }
    }

    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
    {
      xmlhttp = new XMLHttpRequest();
    }

    var url = 'scripts/getLista.php?subfamilia=' +
encodeURIComponent(subfamilia);

    xmlhttp.open('GET', url, true);

    xmlhttp.onreadystatechange=function()
    {
      switch (xmlhttp.readyState)
      {
        case 1:
          document.getElementById('lista').innerHTML = "Loading...";
          break;

        case 4:
          document.write("before <br />");

          document.write(xmlhttp.responseText + "<br />");

          var tabla = eval(xmlhttp.responseText);
          document.write(tabla[2] + "<br />");

          document.write("after <br />");

        break;
      }
    }
    xmlhttp.send(null)
    return;
}

The behaviour is this:
- If I comment the eval line, the I can see the "after" and "before",
as well as the string returned by JSON from the PHP code.

- If I un-comment the string, I'll see "after" and ths JSON string,
but the app will freeze after that.

Thanks for any help.

Pablo


--- In json@yahoogroups.com, Fang Yidong <fangyidong@...> wrote:
>
>
> Show your source code of client side and server side
> to us, and maybe we can figure out what the problem
> is.
>
> --- rancioadams <comomolo@...>:
>
> > Hi everyone. I'm new to this group so I'd like to
> > say hello. My name
> > is Pablo, despite of the dumb name in my email.
> >
> > My little AJAX app doesn't like the JSON encoded
> > strings returned from
> > the PHP part of the app. I mean, the PHP code
> > returns an apparently
> > correct string and I can see the data if I put the
> > JSON string
> > directly into the div element, but my javascript
> > hangs if I try to
> > eval the string. If I create an "identical" string
> > manually, my
> > javascript evaluates it correctly. This suggests the
> > JSON string
> > contains unprintable non-eval'able characters. I'm
> > about to give up
> > and write a little parsing code for this particular
> > need.
> >
> > Any ideas?
> >
> > Pablo
> >
> > PS: When I'm finished with this little job, I might
> > help with the
> > Spanish translations of the JSON pages.
> >
> >
> >
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor
> > --------------------~-->
> > You can search right from your browser? It's easy
> > and it's free.  See how.
> >
> http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
> >
> --------------------------------------------------------------------~->
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >     json-unsubscribe@yahoogroups.com
> >
> >
> >
> >
> >
>
>
>
> ___________________________________________________________
> JSON: Action in AJAX!
>
> JSON - http://www.json.org
> JSON.simple - http://www.json.org/java/simple.txt
>
>
>
>
> ___________________________________________________________
> ÇÀ×¢ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ£¡
> http://cn.mail.yahoo.com
>

#368 From: "rancioadams" <comomolo@...>
Date: Sat May 27, 2006 4:46 pm
Subject: Re: My javascript app freezes at eval'uating JSON string returned
rancioadams
Send Email Send Email
 
BTW: Here's the string returned by JSON, just in case:

["160","GENERAL DE
OBRA","HORMIGONERAS","REF.","TIPO","CORRIENTE","P\/HORA","LITRO","","","","","EU\
RO\/DIA","SEG.\/DIA",null,null,null,null]

p

--- In json@yahoogroups.com, "rancioadams" <comomolo@...> wrote:
>
> Here's the server code:
> <meta http-equiv="content-type" content="text/html;charset=utf-8">
> <?php
>
> require_once('JSON.php');
> $json = new Services_JSON();
>
> $con=mysql_connect("xxxxx", "xxxxx", "xxxxx");
>
> if (!$con)
>   {
>   die('Could not connect: ' . mysql_error());
>   }
> mysql_select_db("xxxxx", $con);
>
> $subfamilia = utf8_decode($_GET["subfamilia"]);
>
> $sql = "SELECT * FROM equipos WHERE SUBFAMILIA = '$subfamilia'";
>
> $query = mysql_query($sql) or die(mysql_error());
>
> $row = mysql_fetch_row($query);
> echo $json->encode($row);
>
> ?>
>
> And here's the client code:
>
> function getLista(subfamilia)
> {
>    var xmlhttp=false;
>
>    try
>    {
>      xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
>    }
>
>    catch (e)
>    {
>      try
>      {
>        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
>      }
>      catch (E)
>      {
>        xmlhttp = false;
>      }
>    }
>
>    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
>    {
>      xmlhttp = new XMLHttpRequest();
>    }
>
>    var url = 'scripts/getLista.php?subfamilia=' +
> encodeURIComponent(subfamilia);
>
>    xmlhttp.open('GET', url, true);
>
>    xmlhttp.onreadystatechange=function()
>    {
>      switch (xmlhttp.readyState)
>      {
>        case 1:
>          document.getElementById('lista').innerHTML = "Loading...";
>          break;
>
>        case 4:
>          document.write("before <br />");
>
>          document.write(xmlhttp.responseText + "<br />");
>
>          var tabla = eval(xmlhttp.responseText);
>          document.write(tabla[2] + "<br />");
>
>          document.write("after <br />");
>
>        break;
>      }
>    }
>    xmlhttp.send(null)
>    return;
> }
>
> The behaviour is this:
> - If I comment the eval line, the I can see the "after" and "before",
> as well as the string returned by JSON from the PHP code.
>
> - If I un-comment the string, I'll see "after" and ths JSON string,
> but the app will freeze after that.
>
> Thanks for any help.
>
> Pablo
>
>
> --- In json@yahoogroups.com, Fang Yidong <fangyidong@> wrote:
> >
> >
> > Show your source code of client side and server side
> > to us, and maybe we can figure out what the problem
> > is.
> >
> > --- rancioadams <comomolo@>:
> >
> > > Hi everyone. I'm new to this group so I'd like to
> > > say hello. My name
> > > is Pablo, despite of the dumb name in my email.
> > >
> > > My little AJAX app doesn't like the JSON encoded
> > > strings returned from
> > > the PHP part of the app. I mean, the PHP code
> > > returns an apparently
> > > correct string and I can see the data if I put the
> > > JSON string
> > > directly into the div element, but my javascript
> > > hangs if I try to
> > > eval the string. If I create an "identical" string
> > > manually, my
> > > javascript evaluates it correctly. This suggests the
> > > JSON string
> > > contains unprintable non-eval'able characters. I'm
> > > about to give up
> > > and write a little parsing code for this particular
> > > need.
> > >
> > > Any ideas?
> > >
> > > Pablo
> > >
> > > PS: When I'm finished with this little job, I might
> > > help with the
> > > Spanish translations of the JSON pages.
> > >
> > >
> > >
> > >
> > >
> > >
> > > ------------------------ Yahoo! Groups Sponsor
> > > --------------------~-->
> > > You can search right from your browser? It's easy
> > > and it's free.  See how.
> > >
> > http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
> > >
> >
--------------------------------------------------------------------~->
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >     json-unsubscribe@yahoogroups.com
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > ___________________________________________________________
> > JSON: Action in AJAX!
> >
> > JSON - http://www.json.org
> > JSON.simple - http://www.json.org/java/simple.txt
> >
> >
> >
> >
> > ___________________________________________________________
> > ÇÀ×¢ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ£¡
> > http://cn.mail.yahoo.com
> >
>

#369 From: Fang Yidong <fangyidong@...>
Date: Sun May 28, 2006 4:04 am
Subject: Re: My javascript app freezes at eval'uating JSON string returned
fangyidong
Send Email Send Email
 
--- rancioadams <comomolo@...>:

> BTW: Here's the string returned by JSON, just in
> case:
>
> ["160","GENERAL DE
>
OBRA","HORMIGONERAS","REF.","TIPO","CORRIENTE","P\/HORA","LITRO","","","","","EU\
RO\/DIA","SEG.\/DIA",null,null,null,null]
>

It seems that there's a CR or LN between 'GENERAL DE'
and 'OBRA' in the result. In JSON , controls should be
escaped, and CR should be escaped as '\r' and LN
should be escaped as '\n'.Choose a correct
implementation of JSON encoder.


> p
>
> --- In json@yahoogroups.com, "rancioadams"
> <comomolo@...> wrote:
> >
> > Here's the server code:
> > <meta http-equiv="content-type"
> content="text/html;charset=utf-8">
> > <?php
> >
> > require_once('JSON.php');
> > $json = new Services_JSON();
> >
> > $con=mysql_connect("xxxxx", "xxxxx", "xxxxx");
> >
> > if (!$con)
> >   {
> >   die('Could not connect: ' . mysql_error());
> >   }
> > mysql_select_db("xxxxx", $con);
> >
> > $subfamilia = utf8_decode($_GET["subfamilia"]);
> >
> > $sql = "SELECT * FROM equipos WHERE SUBFAMILIA =
> '$subfamilia'";
> >
> > $query = mysql_query($sql) or die(mysql_error());
> >
> > $row = mysql_fetch_row($query);
> > echo $json->encode($row);
> >
> > ?>
> >
> > And here's the client code:
> >
> > function getLista(subfamilia)
> > {
> >    var xmlhttp=false;
> >
> >    try
> >    {
> >      xmlhttp = new
> ActiveXObject('Msxml2.XMLHTTP');
> >    }
> >
> >    catch (e)
> >    {
> >      try
> >      {
> >        xmlhttp = new
> ActiveXObject('Microsoft.XMLHTTP');
> >      }
> >      catch (E)
> >      {
> >        xmlhttp = false;
> >      }
> >    }
> >
> >    if (!xmlhttp && typeof
> XMLHttpRequest!='undefined')
> >    {
> >      xmlhttp = new XMLHttpRequest();
> >    }
> >
> >    var url = 'scripts/getLista.php?subfamilia=' +
> > encodeURIComponent(subfamilia);
> >
> >    xmlhttp.open('GET', url, true);
> >
> >    xmlhttp.onreadystatechange=function()
> >    {
> >      switch (xmlhttp.readyState)
> >      {
> >        case 1:
> >
> document.getElementById('lista').innerHTML =
> "Loading...";
> >          break;
> >
> >        case 4:
> >          document.write("before <br />");
> >
> >          document.write(xmlhttp.responseText +
> "<br />");
> >
> >          var tabla = eval(xmlhttp.responseText);
> >          document.write(tabla[2] + "<br />");
> >
> >          document.write("after <br />");
> >
> >        break;
> >      }
> >    }
> >    xmlhttp.send(null)
> >    return;
> > }
> >
> > The behaviour is this:
> > - If I comment the eval line, the I can see the
> "after" and "before",
> > as well as the string returned by JSON from the
> PHP code.
> >
> > - If I un-comment the string, I'll see "after" and
> ths JSON string,
> > but the app will freeze after that.
> >
> > Thanks for any help.
> >
> > Pablo
> >
> >
> > --- In json@yahoogroups.com, Fang Yidong
> <fangyidong@> wrote:
> > >
> > >
> > > Show your source code of client side and server
> side
> > > to us, and maybe we can figure out what the
> problem
> > > is.
> > >
> > > --- rancioadams <comomolo@>:
> > >
> > > > Hi everyone. I'm new to this group so I'd like
> to
> > > > say hello. My name
> > > > is Pablo, despite of the dumb name in my
> email.
> > > >
> > > > My little AJAX app doesn't like the JSON
> encoded
> > > > strings returned from
> > > > the PHP part of the app. I mean, the PHP code
> > > > returns an apparently
> > > > correct string and I can see the data if I put
> the
> > > > JSON string
> > > > directly into the div element, but my
> javascript
> > > > hangs if I try to
> > > > eval the string. If I create an "identical"
> string
> > > > manually, my
> > > > javascript evaluates it correctly. This
> suggests the
> > > > JSON string
> > > > contains unprintable non-eval'able characters.
> I'm
> > > > about to give up
> > > > and write a little parsing code for this
> particular
> > > > need.
> > > >
> > > > Any ideas?
> > > >
> > > > Pablo
> > > >
> > > > PS: When I'm finished with this little job, I
> might
> > > > help with the
> > > > Spanish translations of the JSON pages.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------ Yahoo! Groups Sponsor
> > > > --------------------~-->
> > > > You can search right from your browser? It's
> easy
> > > > and it's free.  See how.
> > > >
> > >
>
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
> > > >
> > >
>
--------------------------------------------------------------------~->
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >     json-unsubscribe@yahoogroups.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
>
___________________________________________________________

=== message truncated ===



___________________________________________________________
JSON: Action in AJAX!

JSON - http://www.json.org
JSON.simple - http://www.json.org/java/simple.txt







___________________________________________________________
Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ
http://music.yahoo.com.cn/?source=mail_mailbox_footer

#370 From: "rancioadams" <comomolo@...>
Date: Sun May 28, 2006 2:15 pm
Subject: Re: My javascript app freezes at eval'uating JSON string returned
rancioadams
Send Email Send Email
 
Thanks but no, there's not a CR between "GENERAL DE" and "OBRA". Just
some problem with the posting here.

Do the nulls at the end of the string pose a problem to the encoder?

I'm using the enconder found here:
http://pear.php.net/pepr/pepr-proposal-show.php?id=198

Regards.

p

--- In json@yahoogroups.com, Fang Yidong <fangyidong@...> wrote:
>
>
> --- rancioadams <comomolo@...>:
>
> > BTW: Here's the string returned by JSON, just in
> > case:
> >
> > ["160","GENERAL DE
> >
>
OBRA","HORMIGONERAS","REF.","TIPO","CORRIENTE","P\/HORA","LITRO","","","","","EU\
RO\/DIA","SEG.\/DIA",null,null,null,null]
> >
>
> It seems that there's a CR or LN between 'GENERAL DE'
> and 'OBRA' in the result. In JSON , controls should be
> escaped, and CR should be escaped as '\r' and LN
> should be escaped as '\n'.Choose a correct
> implementation of JSON encoder.
>
>
> > p
> >
> > --- In json@yahoogroups.com, "rancioadams"
> > <comomolo@> wrote:
> > >
> > > Here's the server code:
> > > <meta http-equiv="content-type"
> > content="text/html;charset=utf-8">
> > > <?php
> > >
> > > require_once('JSON.php');
> > > $json = new Services_JSON();
> > >
> > > $con=mysql_connect("xxxxx", "xxxxx", "xxxxx");
> > >
> > > if (!$con)
> > >   {
> > >   die('Could not connect: ' . mysql_error());
> > >   }
> > > mysql_select_db("xxxxx", $con);
> > >
> > > $subfamilia = utf8_decode($_GET["subfamilia"]);
> > >
> > > $sql = "SELECT * FROM equipos WHERE SUBFAMILIA =
> > '$subfamilia'";
> > >
> > > $query = mysql_query($sql) or die(mysql_error());
> > >
> > > $row = mysql_fetch_row($query);
> > > echo $json->encode($row);
> > >
> > > ?>
> > >
> > > And here's the client code:
> > >
> > > function getLista(subfamilia)
> > > {
> > >    var xmlhttp=false;
> > >
> > >    try
> > >    {
> > >      xmlhttp = new
> > ActiveXObject('Msxml2.XMLHTTP');
> > >    }
> > >
> > >    catch (e)
> > >    {
> > >      try
> > >      {
> > >        xmlhttp = new
> > ActiveXObject('Microsoft.XMLHTTP');
> > >      }
> > >      catch (E)
> > >      {
> > >        xmlhttp = false;
> > >      }
> > >    }
> > >
> > >    if (!xmlhttp && typeof
> > XMLHttpRequest!='undefined')
> > >    {
> > >      xmlhttp = new XMLHttpRequest();
> > >    }
> > >
> > >    var url = 'scripts/getLista.php?subfamilia=' +
> > > encodeURIComponent(subfamilia);
> > >
> > >    xmlhttp.open('GET', url, true);
> > >
> > >    xmlhttp.onreadystatechange=function()
> > >    {
> > >      switch (xmlhttp.readyState)
> > >      {
> > >        case 1:
> > >
> > document.getElementById('lista').innerHTML =
> > "Loading...";
> > >          break;
> > >
> > >        case 4:
> > >          document.write("before <br />");
> > >
> > >          document.write(xmlhttp.responseText +
> > "<br />");
> > >
> > >          var tabla = eval(xmlhttp.responseText);
> > >          document.write(tabla[2] + "<br />");
> > >
> > >          document.write("after <br />");
> > >
> > >        break;
> > >      }
> > >    }
> > >    xmlhttp.send(null)
> > >    return;
> > > }
> > >
> > > The behaviour is this:
> > > - If I comment the eval line, the I can see the
> > "after" and "before",
> > > as well as the string returned by JSON from the
> > PHP code.
> > >
> > > - If I un-comment the string, I'll see "after" and
> > ths JSON string,
> > > but the app will freeze after that.
> > >
> > > Thanks for any help.
> > >
> > > Pablo
> > >
> > >
> > > --- In json@yahoogroups.com, Fang Yidong
> > <fangyidong@> wrote:
> > > >
> > > >
> > > > Show your source code of client side and server
> > side
> > > > to us, and maybe we can figure out what the
> > problem
> > > > is.
> > > >
> > > > --- rancioadams <comomolo@>:
> > > >
> > > > > Hi everyone. I'm new to this group so I'd like
> > to
> > > > > say hello. My name
> > > > > is Pablo, despite of the dumb name in my
> > email.
> > > > >
> > > > > My little AJAX app doesn't like the JSON
> > encoded
> > > > > strings returned from
> > > > > the PHP part of the app. I mean, the PHP code
> > > > > returns an apparently
> > > > > correct string and I can see the data if I put
> > the
> > > > > JSON string
> > > > > directly into the div element, but my
> > javascript
> > > > > hangs if I try to
> > > > > eval the string. If I create an "identical"
> > string
> > > > > manually, my
> > > > > javascript evaluates it correctly. This
> > suggests the
> > > > > JSON string
> > > > > contains unprintable non-eval'able characters.
> > I'm
> > > > > about to give up
> > > > > and write a little parsing code for this
> > particular
> > > > > need.
> > > > >
> > > > > Any ideas?
> > > > >
> > > > > Pablo
> > > > >
> > > > > PS: When I'm finished with this little job, I
> > might
> > > > > help with the
> > > > > Spanish translations of the JSON pages.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------ Yahoo! Groups Sponsor
> > > > > --------------------~-->
> > > > > You can search right from your browser? It's
> > easy
> > > > > and it's free.  See how.
> > > > >
> > > >
> >
> http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
> > > > >
> > > >
> >
> --------------------------------------------------------------------~->
> > > > >
> > > > >
> > > > >
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >     json-unsubscribe@yahoogroups.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> >
> ___________________________________________________________
>
> === message truncated ===
>
>
>
> ___________________________________________________________
> JSON: Action in AJAX!
>
> JSON - http://www.json.org
> JSON.simple - http://www.json.org/java/simple.txt
>
>
>
>
>
>
>
> ___________________________________________________________
> Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ
> http://music.yahoo.com.cn/?source=mail_mailbox_footer
>

Messages 340 - 370 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