Last active
August 29, 2015 14:19
-
-
Save cazala/c663700521fceee89277 to your computer and use it in GitHub Desktop.
API Template: Standard JSON Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replace {{projectPkg}} | |
package org.mule.{{projectPkg}}.transformers; | |
import org.json.JSONObject; | |
import org.mule.api.transformer.TransformerException; | |
import org.mule.sdg.utils.JsonWrapper; | |
import org.mule.transformer.AbstractTransformer; | |
public class StandardJsonWrapper extends AbstractTransformer { | |
@Override | |
protected Object doTransform(Object src, String enc) | |
throws TransformerException { | |
JSONObject jsonObj = JsonWrapper.wrapMessage(src.toString(), true, ""); | |
return jsonObj.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment