Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Informatique1
Contributor III
Contributor III

Column name is an integer

Hello,

I use tWriteJsonField to send it into the body of an API.

The problem is that one of the field needed for the API is a number:

0695b00000SqRShAAN.png

How can I do it?

Thanks

Labels (5)
1 Solution

Accepted Solutions
Informatique1
Contributor III
Contributor III
Author

So finally I manage to create a simple String in a T_Java to make my Json inside an array []. As it was impossible with tWriteJsonField which always start by

{"root", [...data...]}.

And it works 🙂

Sometimes the easiest way is the best^^

Oh and not in the body but in the string of the API. And activating the "Log messages" option in Advanced settings in the tRESTClient is VERY helpfull.

Thanks gJeremy for your time and your help 🙂

View solution in original post

13 Replies
gjeremy1617088143

HI, here a workaround , you can name your attribute with non special char then after change it with the one you want with a tReplace component for example.

Send me love and kudos

Informatique1
Contributor III
Contributor III
Author

Thanks, but I don't see how tReplace can change the name of the column when it only change the value?

gjeremy1617088143

if your output is a type String, you can replace all you want in with a tReplace so you can name your attribute with a really specific Name like @attributeToChange for example and then looking for this and replace it with is real name here 1473

Informatique1
Contributor III
Contributor III
Author

I seriously don't see what I'm supposed to do to change the column name and not the value 😕

0695b00000SqZLFAA3.png

gjeremy1617088143

If the output of your tWriteJsonField have a field of type String wich contain your Json, you can use a tReplace on it, so you'll overwrite all you want in the json, before sending it to the api.

 

tWriteJsonField -->tReplace--> tRestClient

Informatique1
Contributor III
Contributor III
Author

I tried: tWriteJsonField -->tReplace--> tRestClient

 

With:

0695b00000Sqa4tAAB.pngoutput column of my tWriteJson

0695b00000Sqa53AAB.pnginside tReplace:

0695b00000SqZyXAAV.png 

The result is still the same in the log:

{"rootTag":{"data":{"@id":"5960","attributes":{"element":{"@idContext":"0","@idLanguage":"1","@value":"1880"}}}}}

 

It does not change the element name by 1473.

gjeremy1617088143

uncheck wole word checkbox in the tReplace will do the job

Informatique1
Contributor III
Contributor III
Author

I'm still getting a 400 bad request.

It does not change if I send with tWriteJson or a simple string that looks like a Json. The tRestClient don't take it, in the string or the body.

I use Patch/Json/json.

Perfectly working on postman but nothing in the studio 😕

Thanks for your time and answers.

gjeremy1617088143

have you tried to do it via postman before try it into talend ?