Dasel
v2
v2
  • Introduction
  • GitHub
  • Supported file formats
  • Memory usage
  • Installation
  • Commands
    • Select
    • Put
    • Delete
  • Functions
    • Selector Overview
    • All
    • And
    • Append
    • Count
    • Equal
    • Filter
    • FilterOr
    • First
    • Index
    • Join
    • Key
    • Keys
    • Last
    • Len
    • LessThan
    • MapOf
    • Merge
    • MoreThan
    • Not
    • Or
    • OrDefault
    • Parent
    • Property
    • String
    • Null
    • This
    • Type
  • Examples
    • Using dasel as a go package
    • Basics
    • Change file format
    • Filtering objects based on present/missing key
Powered by GitBook
On this page
  • JSON to YAML
  • YAML to CSV
  • CSV to JSON
Edit on GitHub
  1. Examples

Change file format

Dasel allows you to quickly and easily change the format of a file.

JSON to YAML

$ echo '{
  "users": [
    {
      "name": "Tom"
    },
    {
      "name": "Jim"
    }
  ]
}' | dasel -r json -w yaml
users:
- name: Tom
- name: Jim

YAML to CSV

$ echo 'users:
- name: Tom
- name: Jim' | dasel -r yaml -w csv 'users'  
name
Tom
Jim

CSV to JSON

$ echo 'name
Tom
Jim
' | dasel -r csv -w json
[
  {
    "name": "Tom"
  },
  {
    "name": "Jim"
  }
]
PreviousBasicsNextFiltering objects based on present/missing key

Last updated 2 years ago