Transforming Json into Jquery object

Hi guys,

Do any of you know if you can convert a JSON object into a Jquery object ?
The reason i wish to do that is to be able to use the jquery selector to filter my Json data. (for example filter them based on their properties)

I see ur point. I just assumed jQuery would be using some complex algorithm (similar to dbms algorithms) to query through objects. Frankly i’ve never taken a peak at the jQuery internal code.
My JSON objects are relational database tables and i keep selecting,updating, and deleting them like one would with any database.

No, the JSON string is not 5+mb, so i guess i’ll just resort to looping through the objects.


Why don’t you filter through your server side language instead? It will be much faster than filtering through javascript.

You think jQuery wouldn’t have to loop to fight the record you want? :slight_smile:
I don’t know how your JSON object looks like so I can’t give you any other useful input but it’s easy to access certain properties of an object.
From what you’ve written, I’m assuming you wanted to use jQuery’s ccs-like way of accessing properties. Even if it was possible, a straightforward loop would be faster sadly.
If your JSON object isn’t made out of 5+mb string, I doubt you’ll feel any performance issues.
I read your PHP thread where you enquired about the web ERP and I noticed you’re transmitting a lot of data in form of JSON across several hosts.
I’ve done a similar project, and as long as you don’t have HUGE strings that get turned to javascript objects - you won’t notice any slowdowns.
On my testing machine (AMD X2 4200, 2gb RAM, windows 7) and Chrome I was able to work with 5mb worth of data converted to javascript object without any noticeable performance drop.
Just don’t ask me why it was 5mb :slight_smile:

You loop trough the json object and select what you want, discard what you don’t want.
Quick and dirty solutions are sometimes the best.

LOL, no, i use it to send data between server and browser.
But on the subject, you have any good ideas on how to sync 2 or more mysql hosts ?
If you do, please reply on the other thread (web ERP), as this subject is about javascript.

I’m hoping you are not using JSON to transfer and sync data between multiple hosts.
Also, arrays are using indexed access method so there’s no reason why you wouldn’t be able to do something like json.table.record[1] if you construct your object accordingly.

yeah Blue that’s what i’m currently doing. But I was hoping for faster and better algorithm , and I assumed jQuery has one…

i need to minimize transfer between server and client (due to slow internet connection). So if the client can do the work i prefer it does it independently.