1

i want to get the "Name" value (i.e xyz,abc,mno,mxc) from the json data, but as the parent node ids are different i am not able to parse it ..??

"all": {
    "id55": {
        "Tid": "1",
        "Name": "xyz",
        "TypeName": "author"
    },
    "id56": {
        "Tid": "2",
        "Name": "abc",
        "TypeName": "author"
    },
    "id57": {
        "Tid": "3",
        "Name": "mno",
        "TypeName": "author"
    },
    "id58": {
        "Tid": "4",
        "Name": "mzc",
        "TypeName": "author"
    },
}

2 Answers 2

3
var all = {
            "id55": {
                "Tid": "1",
                "Name": "xyz",
                "TypeName": "author"
            },
            "id56": {
                "Tid": "2",
                "Name": "abc",
                "TypeName": "author"
            },
            "id57": {
                "Tid": "3",
                "Name": "mno",
                "TypeName": "author"
            },
            "id58": {
                "Tid": "4",
                "Name": "mzc",
                "TypeName": "author"
            }
        }
for (var a in all) {
  console.log(all[a].Name);
}

output

xyz
abc
mno
mzc
Sign up to request clarification or add additional context in comments.

1 Comment

aww hate it when that happens :)
2

You can use $.each() to iterate over your object and get Name value:

$.each(all, function(i,val) {
   console.log(all[i].Name);
});

Fiddle Demo

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.