Transform JSON with JQ

Big “THANK YOU” to each of you. This was a challenge I’d been struggling with for several days. It’s working exactly as I’d wanted now.

so…what was the problem, and what solution?

The problem was how to parse only the data i needed from a JSON string and place each piece into separate columns. The Transform JSON function wasn’t working but @Darren_Murphy’s JavaScript technique along with your tweak worked perfectly once I figured out how to use the P2 field in the JavaScript column.

Ok… thanks again!

Let’s play some scenarios in order to be more efficient if the circunstancies allow it:

  1. how many rows (bookings) does your table have? Let’s assume that it has 2,000 rows.
    if your APP is used by 5 users and each one opened it 3 times in 1 hour to see the charges, did your management system API have to handle 30,000 requests in 1 hour?
    It’s too much data and work according to my point of view.

  2. Wouldn’t it be better to parse the JSON payload only when the user presses the details screen?
    I mean, the user sees the customer list from your APP, if he wants to see a specific charge list belonging to a customer, the APP will load and show the Details screen and from this point on, your app will fire an API call requesting data from that specific customer and then parse the JSON payload putting that information into multiple columns (as many as you want).

Probabilistically (I think), your API must work 1-2% only in this case and your APP should be faster.

I hope it helps, have a nice night.

Saludos!

If you’re hard coding the p2 value, then you don’t need to bother using it at all.
ie. in the example you gave, you could just write:

return json[1].amount;
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.