Skip to content

sjmulder/json-yaml

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

json-yaml

Build status

json-yaml [file]

yaml-json [file]

Convert JSON to YAML or back. Uses standard input if no filename is supplied.

Examples

$ json-yaml sample.json

firstName: John
lastName: Smith
isAlive: true
age: 25
address:
  streetAddress: 21 2nd Street
  city: New York
  state: NY
  postalCode: 10021-3100
phoneNumbers:
- type: home
  number: 212 555-1234
[...]

$ yaml-json sample.yaml

{
  "firstName": "John",
  "lastName": "Smith",
  "isAlive": true,
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
[...]

$ curl -s http://api.icndb.com/jokes/random | json-yaml

type: success
value:
  id: 415
  joke: When Chuck Norris wants an egg, he cracks open a chicken.
  categories: []

Installation

Dependencies:

From souce, after tweaking the Makefile to taste:

make
make check
make install   [DESTDIR=] [PREFIX=/usr/local]

To uninstall:

make uninstall [DESTDIR=] [PREFIX=/usr/local]

Authors

Sijmen Mulder (ik@sjmulder.nl)