0

If I receive data from a server in plain JSON that looks like this:

{
    "f223dc3c-946f-4da3-8e77-e8c1fe4d241b": {
        "name": "Dave",
        "age": 16,
        "jobs": [{
            "description": "Sweep the floor",
            "difficulty": 4
        },{
            "description": "Iron the washing",
            "difficulty": 6
        }]
    },
    "84af889a-8fc9-499b-a6ea-97e7a483130c": {
        ...
    }
}

Do I need to loop through all the jobs and convert them to Maps, then convert each object's jobs into a List, then the entire thing into a Map?

Or does ImmutableJS do this all recursively for me?

1
  • That's why I didn't say it was JSON - I said I have JSON that "looks like this"... apologies if it was too unclear for you. I have updated it to actual JSON. Commented Oct 26, 2015 at 23:57

1 Answer 1

1

There is Immutable.fromJS() designed for exactly that.

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

Comments

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.