public class

JSONEscaper

extends Object
java.lang.Object
   ↳ com.atlassian.jira.util.json.JSONEscaper

Class Overview

Escape util for JSON data

Summary

Public Constructors
JSONEscaper()
Public Methods
static String escape(String jsonStringValue)
This will escape a value ready to go into a JSON string value.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public JSONEscaper ()

Public Methods

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