Примеры
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