On Jan 6, 2010, at 3:47 PM, Michael Check wrote:

> Robert
> 
> Did you ever post the json parsing routine?  We have need for
> something like this.  We're sending json data from a Rails application
> to A4D and would like to be able to parse the data into a4d chunks.
> 
> Thanks!
> 
> Michael Check

I guess we did not get a reply, or the reply was private.

I asked about a json parse routine a few months back but didn't get a response.

I wrote one a couple years ago but was not happy with the code, it seemed to 
work, but it was a port from some other language and I really didn't understand 
how it worked.

I also wrote a jsonParseSimple method and posted it a few months ago. It worked 
for what I was doing then, but when I went a little more complex, I found some 
problems. I think I took care of those problems. It is patterned after the 
original regex javascript parse routine. Since it is "simple", it has 
limitations: only handles text and longint arrays.

The cleaned up version:
        Pre-process
                Converts IETF format dates to call a method that converts it to 
4d dates.
                Replaces characters between double quotes that would create 
problems with the rest of the parsing (",:').
        Conversion (regex replace)
                Converts json objects {} to new collection calls.
                Converts json arrays []  to call a method newArray that creates 
an integer or text array.
                Puts back the problem characters.
        Executes the results and creates a collection.

I don't handle UTF, but if someone knows about UTF, it should not be that hard 
to convert \uxxxx to something.

Contact me privately if you are interested - it's only about 100 lines of 
code/comments in 4 methods. Works fine from 4D to 4D, don't know how it would 
handle Ruby but it should work unless the data outside the limitations.

Steve Alex

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to