com.atlassian.jira.util.json
Class JSONEscaper

java.lang.Object
  extended by com.atlassian.jira.util.json.JSONEscaper

public class JSONEscaper
extends Object

Escape util for JSON data

Since:
v3.13

Constructor Summary
JSONEscaper()
           
 
Method Summary
static String escape(String jsonStringValue)
          This will escape a value ready to go into a JSON string value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONEscaper

public JSONEscaper()
Method Detail

escape

public static String escape(String jsonStringValue)
This will escape a value ready to go into a JSON string value.

NOTE : IT DOES NOT put the double quotes " around the string value and hence you can safely append the returned value to another JSON string value

This handles the use case where you are concattenating values that ultimately will be a JSON string value but you dont want double quotes around too early.

Parameters:
jsonStringValue - JSON string value
Returns:
an escaped JSON string value, returns empty string if the value is null


Copyright © 2002-2012 Atlassian. All Rights Reserved.