json to json transformation in apigee

Not applicable

I want to know how to do json to json transformation in apigee.

We can try javascript.But I guess transformation through javascript is going to be performance overhead.

Gone through this link http://stackoverflow.com/questions/13068267/json-to-json-transformer.And I wanted to know if there is any possibility of using any policy or library to do it in better way.

1 5 564
5 REPLIES 5

> We can try javascript.But I guess transformation through javascript is going to be performance overhead.

I think you should test your hypothesis. Using JS to transform JSON is ... an ideal use of Javascript.

If you have a specific scenario, a specific kind of transform, let me know, I may be able to help build an illustration.

In apigee best practices doc,its adviced not to prefer javascript.

"JavaScript is preferred over Python and Java. However, if performance is the primary requirement, Java should be used over JavaScript."

I have hundreds of elements from the consumer that needs to be transformed to another json message with changes in attribute names.

For eg,

{
  "OldStudent": {
    "Id": 1,
    "Name": "Std1",
    "Class": 1,
    "School": "ABC"
  }
}

This has to be transformed into,
{
  "NewStudent": {
    "Id1": 1,
    "Name1": "Std1",
    "Class1": 1,
    "School1": "ABC"
  }
}

I just gave the above as an example.Basically most of the json attributes will undergo a change.My usecase is complex json with hundreds of attributes.The json object is a complex one.I like to know if anything similar to xslt here.

There is no JS equivalent to XSLT.

I think you should test your hypothesis.

If it performs poorly, we can work something out with Java. But first measure it.

Sure Dino..I told that based upon the apigee bestpractices doc.It says java performs better than javascript

Former Community Member
Not applicable

You could consider something like this: https://github.com/joelvh/json2json