Question

Hello, I'm new to FME desktop, I want to ask if there is a way to add object mapping so i get the value of a key?


Badge

I am making an HTTPCaller request that in return outputs key, I need to make another HTTPCaller request with the value of the returned key (e.g, if returned key = "Yes" value is 15225 | if returned key = "Male" it's corresponding value is 15222)

is there a way to store an object on FME desktop to be used like _instance ??

I think it might be done using JsonValueMapper transformer


2 replies

Badge +10

Assuming you have extracted the key from the json response from your first HTTPCaller you can use an AttributeValueMapper to map to a new value stored in an attribute which can then be used in the following http request

image

Badge

@ebygomm​ 

Thank you so much for the solution, I will be using it.

but seems I have to use the JSONFlattener so to rearrange the JSON because my returned JSON is array of objects and I wanted it to be object of keyValue: anotherKeyValue if it makes sense

 

current object structure

[{"Question": Question_Value, "QuestionId": QuestionId_Value, "", ..},

{"Question": Question_Value, "QuestionId": QuestionId_Value, "", ..},

{"Question": Question_Value, "QuestionId": QuestionId_Value, "", ..}]

desired object structure

{Question_Value: QuestionId_Value,

Question_Value: QuestionId_Value,

Question_Value: QuestionId_Value,..}

Reply