Skip to main content



  • convert(data: unknown, schema: Schema, dataPath: string[], format: DataFormat, oneOfPath?: [string, number][]): unknown

  • Converts the data to the specified format


    • data: unknown

      data to convert

    • schema: Schema

      The JSON schema that describes the structure of the data

    • dataPath: string[]

      A string array that specifies the path to the data within the JSON schema

    • format: DataFormat

      The format to be converted to

    • oneOfPath: [string, number][] = []

      An optional array of two-element tuples that specifies the "oneOf" option to choose, if the schema has oneOf and the data path can match multiple subschemas

    Returns unknown

    • The data converted to the specified format