Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. var obj = {
  2. "company": {
  3. "department_1": {
  4. "Products": {
  5. "unique_keyname_1": {
  6. "product_owner": "co-worker-1",
  7. "update_time": "unix_timestamp_1"
  8. },
  9. "unique_keyname_5": {
  10. "product_owner": "co-worker-4",
  11. "update_time": "unix_timestamp_45"
  12. },
  13. "unique_keyname_8": {
  14. "product_owner": "co-worker-2",
  15. "update_time": "unix_timestamp_5"
  16. }
  17. }
  18. },
  19. "department_2": {
  20. "Products": {
  21. "unique_keyname_3": {
  22. "product_owner": "co-worker-1",
  23. "update_time": "unix_timestamp_21"
  24. },
  25. "unique_keyname_6": {
  26. "product_owner": "co-worker-2",
  27. "update_time": "unix_timestamp_7"
  28. },
  29. "unique_keyname_4": {
  30. "product_owner": "co-worker-3",
  31. "update_time": "unix_timestamp_75"
  32. }
  33. }
  34. }
  35. }
  36. }
  37.  
  38. obj.company.department_1.Products.unique_keyname_1
  39.  
  40. obj["company"]["department_1"]["Products"]["unique_keyname_1"]
  41. // can also be more dynamic as:
  42. obj["company"]["department_"+ department_counter]["Products"]["unique_keyname_" + keyname_counter]
  43.  
  44. var products = [
  45. {
  46. department: 'deparetment_1',
  47. productName: 'Something',
  48. productOwner: 'Someone',
  49. update_time: 'Sometime'
  50. }
  51. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement