Populating datagridview from an object?

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 2 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
supportMIB
Posts: 62
Last visit: Thu Feb 29, 2024 11:17 am

Populating datagridview from an object?

Post by supportMIB »

I have some REST API code that pulls into powershell as an array of objects such as the output below:
  1. created_by         : @{id=27301; name=}
  2. site               :
  3. template           : @{id=1501; name=Modify Security Access}
  4. requester          : @{id=27301; name=}
  5. technician         :
  6. status             : @{id=1; color=#0066ff; name=Open}
  7. subject            : Please make the security changes listed for the employee noted.
  8. is_overdue         : False
  9. due_by_time        : @{display_value=Jun 22, 2021 09:36 AM; value=1624372607116}
  10. id                 : 6197
  11. time_elapsed       :
  12. short_description  : Description here
  13. priority           : @{id=2; color=#006600; name=Affects a user; no workaround is available.}
  14. group              : @{id=302; name=IT General}
  15. created_time       : @{display_value=Jun 21, 2021 02:36 PM; value=1624304207116}
  16. is_service_request : False
  17.  
  18. created_by         : @{id=27301; name=}
  19. site               :
  20. template           : @{id=4; name=Default Request}
  21. requester          : @{id=27301; name=}
  22. technician         :
  23. status             : @{id=1; color=#0066ff; name=Open}
  24. subject            : Telephone for the Computer Office
  25. is_overdue         : True
  26. due_by_time        : @{display_value=Jun 18, 2021 04:01 PM; value=1624050094004}
  27. id                 : 6185
  28. time_elapsed       :
  29. short_description  : Description here
  30. priority           : @{id=3; color=#ff6600; name=Affects some users; production is slowed. }
  31. group              : @{id=302; name=IT General}
  32. created_time       : @{display_value=Jun 18, 2021 02:01 PM; value=1624042894004}
  33. is_service_request : False
Is there a way to easily load each object as an item into a datagridview?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Populating datagridview from an object?

Post by jvierra »

That depends on what you want to load. The object is complex and hierarchical.
This topic is 2 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked