Import: JSON

Creates a data contract by inferring the schema from a JSON data file.

{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}

Given this orders.json:

{
  "order_id": "ORD-1001",
  "order_timestamp": "2024-01-01T10:00:00Z",
  "customer_id": "CUST-1",
  "order_total": 4999,
  "status": "delivered"
}

Run:

datacontract import json --source orders.json

to produce the data contract:

version: 1.0.0
kind: DataContract
apiVersion: v3.1.0
id: my-data-contract
name: My Data Contract
status: draft
servers:
- server: production
  type: local
  format: json
  path: examples/imports/json/orders.json
schema:
- name: orders
  physicalType: object
  description: Generated from JSON object in examples/imports/json/orders.json
  logicalType: object
  physicalName: orders
  properties:
  - name: order_id
    physicalType: string
    logicalType: string
    examples:
    - ORD-1001
  - name: order_timestamp
    physicalType: string
    customProperties:
    - property: format
      value: date-time
    logicalType: string
    examples:
    - '2024-01-01T10:00:00Z'
  - name: customer_id
    physicalType: string
    logicalType: string
# …

{/* END AUTOGENERATED EXAMPLE */}