Object

com.snowplowanalytics.snowplow.enrich.common.utils

JsonUtils

Related Doc: package utils

Permalink

object JsonUtils

Contains general purpose extractors and other utilities for JSONs. Jackson-based.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonUtils
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type DateTimeFields = Option[(NonEmptyList[String], DateTimeFormatter)]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. val extractBase64EncJson: (String, String) ⇒ Validation[String, String]

    Permalink

    Decodes a Base64 (URL safe)-encoded String then validates it as correct JSON.

  9. def extractJson(field: String, instance: String): Validation[String, JsonNode]

    Permalink

    Converts a JSON string into a Validation[String, JsonNode] Version 2.6.7 of jackson can send back null instead of exception here

    Converts a JSON string into a Validation[String, JsonNode] Version 2.6.7 of jackson can send back null instead of exception here

    field

    The name of the field containing JSON

    instance

    The JSON string to parse

    returns

    a Scalaz Validation, wrapping either an error String or the extracted JsonNode

  10. val extractUnencJson: (String, String) ⇒ Validation[String, String]

    Permalink

    Validates a String as correct JSON.

  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. def stripInstanceEtc(message: String): Option[String]

    Permalink

    Strips the instance information from a Jackson parsing exception message:

    Strips the instance information from a Jackson parsing exception message:

    "... at [Source: java.io.StringReader@1fe7a8f8; line: 1, column: 2]"" ^^^^^^^^

    Also removes any control characters and replaces tabs with 4 spaces.

    message

    The exception message which needs tidying up

    returns

    the same exception message, but with instance information etc removed. Option-boxed because the message can be null

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toJField(key: String, value: String, bools: List[String], ints: List[String], dateTimes: DateTimeFields): JField

    Permalink

    Converts an incoming key, value into a json4s JValue.

    Converts an incoming key, value into a json4s JValue. Uses the lists of keys which should contain bools, ints and dates to apply specific processing to those values when found.

    key

    The key of the field to generate. Also used to determine what additional processing should be applied to the value

    value

    The value of the field

    bools

    A List of keys whose values should be processed as boolean-like Strings

    ints

    A List of keys whose values should be processed as integer-like Strings

    returns

    a JField, containing the original key and the processed String, now as a JValue

  21. def toJsonSchemaDateTime(str: String, fromFormat: DateTimeFormatter): String

    Permalink

    Reformats a non-standard date-time into a format compatible with JSON Schema's date-time format validation.

    Reformats a non-standard date-time into a format compatible with JSON Schema's date-time format validation. If the String does not match the expected date format, then return the original String.

    str

    The date-time-like String to reformat to pass JSON Schema validation

    returns

    the reformatted date-time String if possible, or otherwise the original String

  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. def unsafeExtractJson(instance: String): JsonNode

    Permalink

    Converts a JSON string into a JsonNode.

    Converts a JSON string into a JsonNode.

    UNSAFE - only use it for Strings you have created yourself. Use extractJson for all external Strings.

    instance

    The JSON string to parse

    returns

    the extracted JsonNode

  24. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped