Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //tenho a seguinte estrutura:
- var data =
- [
- {
- "id":"1",
- "title":"sem vinculo",
- "parent_id":"0"
- },
- {
- "id":"2",
- "title":"vinculo com campanha id 2",
- "parent_id":"2"
- },
- {
- "id":"3",
- "title":"vinculo com campanha id 2",
- "parent_id":"2"
- }
- ]
- //como faço para montar ela assim?
- var data =
- [
- {
- "id":"1",
- "title":"sem vinculo",
- "parent_id":"0",
- "nodes": [
- {
- "id":"2",
- "title":"vinculo com campanha id 1",
- "parent_id":"1",
- "nodes": [
- {
- "id":"3",
- "title":"vinculo com campanha id 2",
- "parent_id":"2",
- "nodes": []
- }
- ]
- }
- ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement