Hugo Future Imperfect Slim

uChe . LIFE

義理と人情、察しと思いやり

json -> yaml 変換

使うことがあるかも?!

uChe

1 分で読めます

json -> yaml 変換

sample.json

{
  "data": [{
    "type": "articles",
    "id": "1",
    "attributes": {
      "created": "2020-05-22T14:56:29.000Z",
      "updated": "2020-05-22T14:56:28.000Z"
    },
    "relationships": {
      "author": {
        "data": {"id": "42", "type": "people"}
      }
    }
  }],
  "included": [
    {
      "type": "people",
      "id": "42",
      "attributes": {
        "name": "John",
        "age": 80,
        "gender": "male"
      }
    }
  ]
}
 $ ruby -ryaml -rjson -e 'puts YAML.dump(JSON.parse(STDIN.read))' <  sample.json

最近の投稿

カテゴリー

About

うすくひろくなんでもやるインフラ屋です。