JSON 轉 YAML

在相應的資料表示、格式或計量單位之間执行“JSON 轉 YAML”。

輸入: 文本結果: 文本

文本輸入

執行後查看結果

範例

Convert the RFC 8259 image metadata object

輸入

{"Image":{"Width":800,"Height":600,"Title":"View from 15th Floor","Thumbnail":{"Url":"http://www.example.com/image/481989943","Height":125,"Width":100},"Animated":false,"IDs":[116,943,234,38793]}}

Expected answer

Image:
  Width: 800
  Height: 600
  Title: View from 15th Floor
  Thumbnail:
    Url: http://www.example.com/image/481989943
    Height: 125
    Width: 100
  Animated: false
  IDs:
    - 116
    - 943
    - 234
    - 38793
Convert a GeoJSON feature without reversing its coordinates

Coordinates remain longitude, latitude: 102, 0.5.

輸入

{"type":"Feature","geometry":{"type":"Point","coordinates":[102.0,0.5]},"properties":{"prop0":"value0"}}

Expected answer

type: Feature
geometry:
  type: Point
  coordinates:
    - 102.0
    - 0.5
properties:
  prop0: value0
Make a nested deployment configuration readable

輸入

{"service":"image-resizer","replicas":2,"ports":[8080,9090],"health":{"path":"/ready","timeoutSeconds":3}}

Expected answer

service: image-resizer
replicas: 2
ports:
  - 8080
  - 9090
health:
  path: /ready
  timeoutSeconds: 3
Keep strings that look like numbers or null as strings

00123, null and the empty value are strings here; missing is a real null.

輸入

{"postalCode":"00123","literalNull":"null","empty":"","enabled":false,"retries":3,"missing":null}

Expected answer

postalCode: '00123'
literalNull: 'null'
empty: ''
enabled: false
retries: 3
missing: null
Convert an ordered shopping list with repeated item names

輸入

[{"item":"coffee","grams":250},{"item":"coffee","grams":500},{"item":"tea","grams":100}]

Expected answer

- item: coffee
  grams: 250
- item: coffee
  grams: 500
- item: tea
  grams: 100
Convert a 64-bit identifier without rounding

輸入

{"id":18446744073709551615}

Expected answer

id: 18446744073709551615
Keep every digit of a decimal amount

輸入

{"amount":12345678901234567890.123456789}

Expected answer

amount: 12345678901234567890.123456789
JSON to YAML

輸入

{ "number": 3, "plain": "string" }

Expected answer

number: 3
plain: string

相关工具

資料格式

操作参考

查看原始技术文檔 (English)