I missed that you had already found Oliver's code. My point was that Flash eval is not powerful enough to parse JSON, so you will need Oliver's code.

We're strongly considering supporting JSON as a data format, but I am unaware of any finished work that you can leverage on. If you don't need replication, you could just use constraints to bind the JSON object to your view.

On 2007-02-08, at 11:52 EST, Dave Brueck wrote:

Thanks for replying P T. Can you elaborate on your answer though?

As I mentioned in my post, I had already found Oliver's JSON library but it did not appear to address what I'm trying to do. To be sure, though, after getting your reply I downloaded his library again and read through everything again, and either I'm just misunderstanding something or it doesn't do what I need.

I understand how to get raw JSON data into a Javascript object; what I'm trying to do is get that into some form that I can use it as a dataset.

Thanks for your time,
-Dave

P T Withington wrote:
http://osteele.com/archives/2006/02/json-for-openlaszlo
On 2007-02-08, at 11:17 EST, Dave Brueck wrote:
Hi all,

I'm writing a SOLO app that needs to pull data dynamically over HTTP. The problem is that the data is from an existing service and is returned in the JSON format and not XML. In my app I'd like to be able to use the normal dataset stuff though (e.g. populate a grid component).

I've looked around and this doesn't appear to be directly supported (but please let me know if I've overlooked something) so one thought I had was to receive the JSON data, eval it to make it a Javascript object, and then have a function that converts it to a form useable as a dataset (e.g. use LzDataElement and related objects).

The data is always coming from a "safe" source and I can use any version of Flash, so it should be ok for me to just eval() the raw JSON to get a Javascript object. I can also target any version of OpenLaszlo (currently using 4.0B1) if that helps.

Has anyone already written code to do this? Is converting a Javascript object as I described the best approach? Is it hideously slow? I've looked at Oliver Steele's nice JSON library, but that seems to deal with getting the data into Javascript object form - I couldn't see how to take the next step and use it as a datasource.

Thanks for any tips or pointers you can give me. I'd be thrilled to learn that I'm overlooking something easy and obvious. :)

-Dave


Reply via email to