YAML-to-JSON and JSON-to-YAML conversion #238
              
                
                  
                  
                    Answered
                  
                  by
                    TomWright
                  
              
          
                  
                    
                      electriquo
                    
                  
                
                  asked this question in
                Q&A
              
            -
| Some other tools, convert YAML-to-JSON and JSON-to-YAML and even XML-to-JSON/YAML $ echo 'foo: bar' | yq -c
{"foo":"bar"}
$ echo 'foo: bar' | yq -c | yq -y
foo: barI would love to see  | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            TomWright
          
      
      
        Jul 12, 2022 
      
    
    Replies: 1 comment
-
| This is already possible using the  $ echo 'foo: bar' | dasel -r yaml -w json -c
{"foo":"bar"}
$ echo 'foo: bar' | dasel -r yaml -w toml
foo = "bar"
$ echo 'foo: bar' | dasel -r yaml -w json | dasel -r json -w yaml
foo: bar
$ echo '<users><user><name>Tom</name></user><user><name>Jim</name></user></users>' | dasel -r xml -w yaml
users:
  user:
  - name: Tom
  - name: JimThe supported file types can be found here: https://daseldocs.tomwright.me/usage/supported-file-types | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        TomWright
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
This is already possible using the
-r,--readand-w,--writeflags. You can read more on them here: https://daseldocs.tomwright.me/usage/selectThe supported file types can be found here: https://daseldocs.tomwright.me/usage/supported-file-types