Answer the question
In order to leave comments, you need to log in
How to "reach" dot notation to a nested object in JSON?
Help with a rather stupid question, but I don’t understand how, I’ve covered the floor of the Internet.
I'm using Vue.js getting from JSON base:
"programs" : {
"Abs" : [ null, {
"bR" : 10.5,
"dR" : {
"oR" : 0,
"p" : 0,
"pro" : 0
},
"fP" : 15,
"l" : "O7",
"name" : "Один из многих",
"tD" : {
"bR" : 0,
"fP" : 0
},
"uR" : {
"i" : 0,
"s" : 0
}
}]
Two: {
"id" : 555
}
}
{{programs[1].id}} // Выводит 555
Answer the question
In order to leave comments, you need to log in
It's the same way to get:
programs["Abs"][2]["name"] //Один из многих
programs["Abs"][1]["dr"]["p"] //0
First, your JSON is invalid. Second, the path programs["Abs"][2] does not exist because programs["Abs"] contains an array of only 2 elements, indexed 0 and 1. Here are examples of how to get some then properties from your json:
programs.Abs[1].bR
programs.Abs[1].dR.oR
programs.Abs[1].name
programs.Two.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question