Timeline for Converting JSON/JS Object to array
Current License: CC BY-SA 3.0
Post Revisions
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 21, 2014 at 17:35 | history | edited | user4097807 | CC BY-SA 3.0 |
added 198 characters in body
|
| Oct 13, 2014 at 17:41 | vote | accept | Community Bot | ||
| Oct 13, 2014 at 17:27 | answer | added | user1572796 | timeline score: 0 | |
| Oct 13, 2014 at 17:27 | comment | added | Felix Kling |
"Yes I know how to iterate over an array/object" Then where are you stuck? You iterate over all elements of obj.data, create a new array for each, iterate over each property of the element and push it to the new array.
|
|
| Oct 13, 2014 at 17:25 | comment | added | user4097807 | The plugin requires it to be in the format that I posted. | |
| Oct 13, 2014 at 17:25 | answer | added | Amit Joki | timeline score: 2 | |
| Oct 13, 2014 at 17:24 | comment | added | Mohamad Shiralizadeh | You can iterate over result.data and then convert each row into an array that contains your row data. | |
| Oct 13, 2014 at 17:24 | comment | added | Matt Burland |
@NoahMatisoff: What were you expecting JSON.stringify to do? You have an array already, so just iterate through it and push the id and name into a new array of arrays.
|
|
| Oct 13, 2014 at 17:24 | comment | added | Felix Kling |
Well, JSON.stringify() encodes an array or object as JSON. It doesn't change the structure of the array or object.
|
|
| Oct 13, 2014 at 17:23 | comment | added | user4097807 | Yes I know how to iterate over an array/object. | |
| Oct 13, 2014 at 17:22 | comment | added | Felix Kling | What have you tried so far? Where are you stuck? Do you know how to iterate over an array or an object? You must have tried something before asking. | |
| Oct 13, 2014 at 17:20 | history | asked | user4097807 | CC BY-SA 3.0 |