Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. var linked_tree = [{
  2. id: '1-abc'
  3. value: '...'
  4. }, {
  5. id: '2-abc',
  6. parent: '1-abc',
  7. value: '...'
  8. }, {
  9. id: '2-def',
  10. parent: '1-abc',
  11. value: '...'
  12. }, {
  13. id: '3-abc',
  14. parent: '2-abc',
  15. value: '...'
  16. }];
  17.  
  18. // Convert to
  19.  
  20. var linked_tree = [{
  21. id: '1-abc'
  22. value: '...',
  23. nodes: [{
  24. id: '2-abc',
  25. parent: '1-abc',
  26. value: '...'
  27. }, {
  28. id: '2-def',
  29. parent: '1-abc',
  30. value: '...',
  31. nodes: [{
  32. id: '3-abc',
  33. parent: '2-abc',
  34. value: '...'
  35. }]
  36. }
  37. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement