-
Hi Me Again, I created a channel where the source is a Database Reader into an oracle database. I have to send this data in JSON format via HTTP, My Question is where do I do the conversion from XML to JSON? I see other post mentioning code, but where is the code placed? The vendor provided the JSON fields. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
In a transformer step of type Javascript in general. You can find videos on YouTube that do walkthroughs. While not your data type conversion, see https://www.youtube.com/watch?v=0cuhCL9xKmg. There are others videos for other data type conversions. |
Beta Was this translation helpful? Give feedback.
-
Great idea about using Oracle to create the JSON, let me investigate that option. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I used a Transformer to convert the XML into JSON, so far so good. var jsEntity = GetEntities();
var jsMedications = GetMedications();
jsMedications.name = msg['name'].toString();
jsMedications.parentid = msg['parentid'].toString();
jsMedications.externalid = msg['externalid'].toString();
jsEntity.entities.push(jsMedications); // ADD IT TO THE ENTITY ARRAY
channelMap.put('Entity_Locations',JSON.stringify(jsEntity));
//=============================
function GetEntities()
{
var jsData =
{
entities: []
};
return jsData;
}
//===========================
function GetMedications()
{
var jsData =
{
name: "",
parentid: "",
externalid: "",
};
return jsData;
} |
Beta Was this translation helpful? Give feedback.
I used a Transformer to convert the XML into JSON, so far so good.
Thanks all