Join data from two JSON arrays

Hi there,

I am trying to join data from two JSON arrays into a single table and think I'm getting stuck on the nested responses. Could I kindly request a pointer

I would like to match the 'address' in Table 2 with the 'validator' in Table 1 and where they match add 'name' to Table 1.

Table 1
image

I hope that makes sense?
Thanks for your time

Adding Table 2 to a follow up post due to restrictions

Table 2

@ajr ,

Two options that I see.

First, use a JSON SQL query and join the two tables together using address=validator. Probably wrong syntax, but you get the point:

select r.amount, v.address, v.name from {{table1.result}} r
join {{table2.validators}} v on r.validator=v.address

If you can;t get this working the you may be stuck brute forcing it.

Write a js query (or transformer) that loops through each result in table 1. .find() matching address in table 2. Add the found name to table 1 and repeat.

1 Like

Thanks @bradlymathews, just after I posted this I managed to join the two tables in general so I now have a single combined table, which works but there is a lot of redundant data I don't need in the table so I will have a go at what you recommend and see how I get on. It would be much cleaner if I can just have a single table with the three entries. thanks again