0

I want to parse the JSON

[ 
{ 
    "food": [ 
        { 
            "name": "pasta", 
            "price": 14.50, 
            "quantity": 20 
        }, 
        { 
            "name": "soup", 
            "price": 6.50, 
            "quantity": 4 
        } 
    ] 
}, 
{ 
    "food": [ 
        { 
            "name": "salad", 
            "price": 2.50, 
            "quantity": 3 
        }, 
        { 
            "name": "pizza", 
            "price": 4.50, 
            "quantity": 2 
        } 
    ] 
} 
] 

How can I get elements from the JSON like each array and element from each array. I have more bigger JSON than this. Line by line parsing of which takes several minutes. Any solution to do it faster.
Expecting link of org JSON util or such and some code for how to use it

1 Answer 1

3

as3corelib is a library that includes a JSON static class that has a function JSON.parse(). This should be already included in your flash project by default.

JSON.parse() takes a String and returns your parsed JSON object. If you need assistance interpreting/accessing the results, there are numerous tutorials for using JSON.parse() on the internet.

Sign up to request clarification or add additional context in comments.

1 Comment

If targeting flash player 11 and up as3corelib is no longer required as flash has native json parsing. Can just do JSON.parse() to get the object or JSON.stringfy() to turn an object into a json string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.