Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Eric_Talend
Creator
Creator

How to convert JSON file to an array ?

Hello,

I must call an API with PUT http method.

I have an JSON file but this API must have an JSON array.

I search and I search any solution (with tWriteJSONField or with "tConvertType"/"tReplace") but none solution is OK.

Has anyone ever had this use case ?

Kind regards.

Labels (3)
6 Replies
Anonymous
Not applicable

Hi

Can you show an example to explain what the Json data looks like? With tWriteJSONField, we can create a Json string as seen below, it contains an array element.

0695b00000KCdG2AAL.jpg

Eric_Talend
Creator
Creator
Author

Hello,

 

I still have the problem.

 

I have this :

 

0695b00000N2LE0AAN.png 

and this is the description of tWriteJSONField :

 

0695b00000N2LEFAA3.png 

But at the end, I don't have my JSON in array format. 😩

 

I'm not an expert of JSON format.

 

Kind regards

 

Eric_Talend
Creator
Creator
Author

I would like to add this precision :

 

the start of "logrow6"

0695b00000N2LL6AAN.png 

Finaly, insert with API not working.

My main problem is the my JSON file is not an array.

The API must have an JSON array.

Anonymous
Not applicable

@Eric Vincent​ , see below screenshot which showing how to define an array element.

0695b00000N2SuhAAF.png 

Please try again and let me know if you have any problem.

 

Regards

Shong​

Eric_Talend
Creator
Creator
Author

Hello,

 

thanks for your proposition.

I try to add this in my job but the result is not good.

 

When I add with CURL, I have this code :

 

 curl -X PUT "https://myURL/api/table/rows" -H "accept: application/json" -H "Authorization: Basic XXX" -H "Content-Type: application/json" -d "[ {   \"logindelagent\": \"XXX\",   \"identifiantastre\": \"111\",   \"projetservice\": \"XXX\",   \"rattachement\": \"XXX\",   \"responsable\": \"XXX\",   \"statut\": \"XXX\" }]"

 

it is this code that I want to reproduce in json.

 

Kind regards.

Eric_Talend
Creator
Creator
Author

oh, I will try to add with CURL by removing "\" before each data and it's KO.

 

So, I must have this caracter before each element 😞