HttpRequest Content CRLF removal

1
Hi All, I have a published web service that receives requests with a JSON body.  When I look at the $HttpRequest.Content  in an editor, it looks like this: If I view all characters in this json, I see this: I don’t want the CRLF characters or the indent spaces at the beginning of the lines.  I am guessing Mendix adds these to the Content.  Anyone have a quick way to get the raw body contents without any formatting? Thanks, Mike ***EDIT*** I accomplished this with 2 microflow actions.  The first removes CRLF: The second removes spaces:
asked
1 answers
2

Hi Mike,

Have you tried removing them in java?

 

// This file was generated by Mendix Modeler.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.

package myfirstmodule.actions;

import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;

public class RemoveCRLF extends CustomJavaAction<java.lang.Boolean>
{
	private java.lang.String String;

	public RemoveCRLF(IContext context, java.lang.String String)
	{
		super(context);
		this.String = String;
	}

	@Override
	public java.lang.Boolean executeAction() throws Exception
	{
		// BEGIN USER CODE
		
		String str = String.replaceAll("(\\r|\\n)", "");
		return str;
		
		// END USER CODE
	}

	/**
	 * Returns a string representation of this action
	 */
	@Override
	public java.lang.String toString()
	{
		return "RemoveCRLF";
	}

	// BEGIN EXTRA CODE
	// END EXTRA CODE
}

 

answered