Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Conversion of Array of numbers to Float/Int in JSON file imported in Cloud fusion pipeline

Hi Community members,

We have imported a JSON with Key-value pairs (From Airtable using HTTP task and Get method) where we will be using Key as column name and values will be column values and insert that to a BQ table. Now one of the key(Semester_id) in JSON(will be column in BQ) is having a value which is an Array of numbers and it's having only a single number value in whole JSON file as shown below:

iamnicks96_0-1688884515665.png

The current output of JSONParser task in cloud fusion is as below which is an array:

iamnicks96_1-1688884647221.png

As per the documentation of JSON parser we can use MIN MAX function to get the min max values out of an int array and output will in in 'double' data type:

iamnicks96_2-1688884827477.png

So I tried to use this min function using both standalone and with Math.min as shown below:

iamnicks96_3-1688884925833.pngiamnicks96_4-1688884954665.png

But after using above, no records were shown in the output of JSON parser if we see using preview:

iamnicks96_5-1688885195756.png

 

Can anyone help us out on how we can extract min/max number from an array of number in JSON Value and give a values in 'double' format that we can pass to a BQ table.

 



0 1 212
1 REPLY 1

Hi @iamnicks96

Looking at the screenshots you have provided, one possible reason that I can think of is that your data has special characters [square brackets] mixed with the numerical values. Since you are using the MIN function, which reads and determines the lowest value across an array of numbers, it will not be able to process non-numerical data hence not returning any records in your table. You may try omitting the special characters and solely work with numerical data for mathematical functions. You can also review your logs to see if there are errors related to the failed conversion.

I hope this helps.

Usable resource:
 - JSON Parser Transformation