Open rrcalvo opened 3 years ago
Also, not sure if this is the best way to do object flatten and unflatten. I just followed the example on the top answer on: https://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objects Let me know if there's a better way to do this. Thanks.
I have a query that results nested objects, e.g.
SELECT id, item.id, item.label, item.price, order.quantity, order.subtotal FROM orders
The current behaviour resulting data from the Items collection is:
[{ id: "O-100", item: { id: "item-12345", label: "Printer", price: "123.99" }, order: { quantity: "1", subtotal: "123.99" qualifies_for_discount: "true" }, }]
I need the resulting nested objects non-string properties in the Items collection to be set as non-string, i.e. not in quotes. Expected result:
[{ id: "O-100", item: { id: "item-12345", label: "Printer", price: 123.99 }, order: { quantity: 1, subtotal: 123.99 qualifies_for_discount: true }, }]
To accomplish this, it seems the record data has to be converted into a flat object map so the loop in the addDataType function can iterate through all properties including those in the nested objects.