Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  157] [ 3]  / answers: 1 / hits: 18477  / 12 Years ago, mon, may 21, 2012, 12:00:00

Is it possible to assign references to objects in JSON? I have data that looks like this:



[{
name:name,
Parent:[{
name:parentName
Parent:[{
.....//and so on
}]
}]
}]


I need to traverse it in JavaScript and also change the person's name. How can I do this?


More From » json

 Answers
44

You can't. You can specify the path to the parent as a string and evaluate that at runtime, but as JSON is just strings, integers, arrays, and dictionaries, you can't use references.


[#85454] Friday, May 18, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aidan

Total Points: 72
Total Questions: 95
Total Answers: 121

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
aidan questions
Mon, Oct 11, 21, 00:00, 3 Years ago
Wed, Sep 29, 21, 00:00, 3 Years ago
Sun, Sep 5, 21, 00:00, 3 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;