JsonUtils (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.value.json, class: JsonUtils

# Class JsonUtils

java.lang.Object
org.apache.cayenne.value.json.JsonUtils

public final class JsonUtils extends Object
Simple utils to process JSON.

Since:
  4.2
See Also:
  - `Json`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `compare(String json1, String json2)`
  Method that compares two JSON documents.
  `static String`
  `normalize(String json)`
  Cleanup and reformat any valid JSON string.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### normalize

    public static String normalize(String json)
    Cleanup and reformat any valid JSON string. Generally this methods just removes unnecessary whitespaces in the document.
    Parameters:
      `json` - valid JSON document
    Returns:
      normalized JSON

  - ### compare

    public static boolean compare(String json1, String json2)

    Method that compares two JSON documents.
    This methods will parse documents so it will ignores object keys ordering and whitespaces.

    NOTE this method doesn't parse numbers so same numbers in different format will be different.
    Parameters:
      `json1` - first value
      `json2` - second value
    Returns:
      true if documents are equal