com.snowplowanalytics.snowplow.enrich.common.utils

JsonUtils

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
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

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

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

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

    Converts a JSON string into a Validation[String, JsonNode]

    Converts a JSON string into a Validation[String, JsonNode]

    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

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

    Validates a String as correct JSON.

  13. def finalize(): Unit

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

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

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

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

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

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

    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

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

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

    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

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

    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

  24. def toString(): String

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

    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

  26. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped