Chinmayee G
Chinmayee G

Reputation: 8117

Create hashmap for JSON in javascript/jquery

Is it possible to generate hashmap for JSON object in javascript/jquery? I've complex and big JSON object. I've to loop through it to filter data based on timings.

What is will be best and optimum approach to get data from JSON/hash map?

Upvotes: 0

Views: 1406

Answers (1)

Barney
Barney

Reputation: 16456

Most browsers contain a native JSON object with a JSON.parse(JSONstring) method for just this. jQuery provides $.getJSON(JSONstring) to return an object from a JSON string in environments that don't natively provide the JSON object.

From there on, getting a useful hashmap depends on the structure of your JSON object. Underscore (and its more performant offshoot, LoDash) contains a lot of useful methods (such as filter) which can help parse, manipulate and retrieve useful data from large objects.

Upvotes: 3

Related Questions