All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.setl.json.package-info Maven / Gradle / Ivy

Go to download

An implementation of the Canonical JSON format with support for javax.json and Jackson

The newest version!
/**
 * This package implements the creation and verification of canonical JSON.
 *
 * 

The definition of canonical JSON was taken from the canonicaljson * project. The definition is reproduced below for convenience.

* *

Definition

* *

JSON text in canonical form:

*
    *
  1. MUST be encoded in UTF-8
  2. *
  3. MUST NOT include insignificant (i.e., inter-token) whitespace (defined in section 2 of * RFC 7159)
  4. *
  5. MUST order the members of all objects lexicographically by the UCS (Unicode Character Set) code points of their names *
      *
    1. preserving and utilizing the code points in U+D800 through U+DFFF (inclusive) for all lone surrogates
    2. *
    *
  6. *
  7. MUST represent all integer numbers (those with a zero-valued fractional part) *
      *
    1. If the integer number has thirty or less trailing zeros: *
        *
      1. without a leading minus sign when the value is zero, and
      2. *
      3. without a decimal point, and
      4. *
      5. without an exponent, and
      6. *
      7. without insignificant leading zeroes (as already required of all JSON numbers)
      8. *
      *
    2. *
    3. If the integer number has more than thirty trailing zeroes, use the rules for non-integer numbers. This prevents attacks by using values such as * "1e+1000000", which would otherwise require a million zeros.
    4. *
    *
  8. *
  9. MUST represent all non-integer numbers in exponential notation *
      *
    1. including a nonzero single-digit significand integer part, and
    2. *
    3. including a nonempty significand fractional part, and
    4. *
    5. including no trailing zeroes in the significand fractional part (other than as part of a “.0” required to satisfy the preceding point), and
    6. *
    7. including a capital “E”, and
    8. *
    9. including no plus sign in the exponent, and
    10. *
    11. including no insignificant leading zeroes in the exponent
    12. *
    *
  10. *
  11. MUST represent all strings (including object member names) in their minimal-length UTF-8 encoding *
      *
    1. avoiding escape sequences for characters except those otherwise inexpressible in JSON (U+0022 QUOTATION MARK, U+005C REVERSE SOLIDUS, and ASCII * control characters U+0000 through U+001F) or UTF-8 (U+D800 through U+DFFF), and
    2. *
    3. avoiding escape sequences for combining characters, variation selectors, and other code points that affect preceding characters, and
    4. *
    5. using two-character escape sequences where possible for characters that require escaping: *
        *
      • \b U+0008 BACKSPACE
      • *
      • \t U+0009 CHARACTER TABULATION (“tab”)
      • *
      • \n U+000A LINE FEED (“newline”)
      • *
      • \f U+000C FORM FEED
      • *
      • \r U+000D CARRIAGE RETURN
      • *
      • \" U+0022 QUOTATION MARK
      • *
      • \\ U+005C REVERSE SOLIDUS (“backslash”), and
      • *
      *
    6. *
    7. using six-character \u00xx uppercase hexadecimal escape sequences for control characters that require escaping but lack a * two-character sequence, and
    8. *
    9. using six-character \uDxxx uppercase hexadecimal escape sequences for lone surrogates
    10. *
    *
  12. *
* * @author Dr Simon Greatrix */ package io.setl.json;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy