Jay,
You could build the whole thing element by element from the top down or you could build the fields element as a separate collection and then add pairs of ids and fields as needed. I prefer the second method but it should not make a huge difference.
Here is my code to assemble your sample result. The real program would clearly need a loop to process each record in turn.
* Create collection to hold final result
result = collection()
result{“records”} = mat()
* Build detail for this vehicle
detail = collection()
detail{“Stock”} = “001578”
detail{“Year”} = “2018”
…etc…
* Build record for this vehicle
record = collection()
record{“id”} = “recvJxU4tRJtIXdyb”
record{“fields”} = detail
* Store record in result
result{“records”, -1} = record
Please let me know if this helps.
Martin
From: ope...@googlegroups.com <ope...@googlegroups.com>
On Behalf Of jaya...@gmail.com
Sent: 06 June 2022 14:23
To: OpenQM <ope...@googlegroups.com>
Subject: Trying to bulid a JSON object using QM data collections tools
EXTERNAL EMAIL |
================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================
This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy
all copies of this communication. Thank you.