I have a json data like this.
sample.json
[
{
"id": 0,
"name": "Cofine",
"title": "laboris minim qui nisi esse amet non",
"description": "Consequat laborum quis exercitation culpa. Culpa esse sint consectetur deserunt non.",
"website": "cofine.com",
"image": "http://placehold.it/32x32",
"labels": ["blue", "red"],
"labels_link": ["http://cofine.com/labels/blue","http://cofine.com/labels/red"],
},
{
"id": 1,
"name": "Zomboid",
"title": "adipisicing mollit esse aliquip ullamco nisi laboris",
"description": "Enim consectetur eu commodo officia. Id pariatur proident nostrud occaecat adipisicing voluptate do nisi incididunt id ex commodo.",
"website": "zomboid.com",
"image": "http://placehold.it/32x32",
"labels": ["red"],
"labels_link": ["http://zomboid.com/labels/red"],
},
{
"id": 2,
"name": "Sulfax",
"title": "non minim anim irure nulla ad elit",
"description": "Pariatur anim officia adipisicing Lorem dolor cillum eu ex veniam sint consequat incididunt. Minim mollit reprehenderit mollit sint laboris consequat.",
"website": "sulfax.com",
"image": "http://placehold.it/32x32",
"labels": ["green", "yellow", "blue"],
"labels_link": ["http://sulfax.com/labels/green","http://sulfax.com/labels/yellow","http://sulfax.com/labels/blue"],
}
]
How do I convert this json data to yaml using PowerShell where each json object will be converted to yaml and saved as yaml in its own file with the file name being the value of the title keys properties?
So the output in yaml would look like this.
laboris minim qui nisi esse amet non.yaml
---
id: 0
name: 'Cofine'
title: 'laboris minim qui nisi esse amet non'
description: Consequat laborum quis exercitation culpa. Culpa esse sint consectetur deserunt non.
website: 'cofine.com'
image: 'http://placehold.it/32x32'
labels:
- 'blue'
- 'red'
labels_link:
- 'http://cofine.com/labels/blue'
- 'http://cofine.com/labels/red'
---
adipisicing mollit esse aliquip ullamco nisi laboris.yaml
---
id: 1
name: 'Zomboid'
title: 'adipisicing mollit esse aliquip ullamco nisi laboris'
description: Enim consectetur eu commodo officia. Id pariatur proident nostrud occaecat adipisicing voluptate do nisi incididunt id ex commodo.
website: 'zomboid.com'
image: 'http://placehold.it/32x32'
labels:
- 'red'
labels_link:
- 'http://zomboid.com/labels/red'
---
non minim anim irure nulla ad elit.yaml
---
id: 2
name: 'Sulfax'
title: 'non minim anim irure nulla ad elit'
description: Pariatur anim officia adipisicing Lorem dolor cillum eu ex veniam sint consequat incididunt. Minim mollit reprehenderit mollit sint laboris consequat.
website: 'sulfax.com'
image: 'http://placehold.it/32x32'
labels:
- 'green'
- 'yellow'
- 'blue'
labels_link:
- 'http://sulfax.com/labels/green'
- 'http://sulfax.com/labels/yellow'
- 'http://sulfax.com/labels/blue'
---
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب: convert json to csv,convert json to xml,convert json to string,convert json to java object,convert json to excel,convert json to csv python,convert json to yaml,convert json to html,convert json to object,convert json to array,
نویسنده: استخدام کار
بازدید: 424
تاريخ: پنجشنبه
4 شهريور
1395 ساعت: 7:39