title: What is the difference between json.Marshal and json.MarshalIndent using Go?
body: <p>I would like to get an output of a CF command in JSON format but I am not sure what to use either <code>json.Marshal</code> or <code>json.MarshalIndent</code>.</p>
  
  <p>The output I need is like this:</p>
  
  <pre><code>{
      "key1": "value1",
       ....
      "keyn": "valuen",
  }
  </code></pre>
  
  <p>This is the old example but it is not the desired output:</p>
  
  <pre><code>cmd.ui.Say(terminal.EntityNameColor(T("User-Provided:")))   
    for _, key := range keys {        
           // cmd.ui.Say("%s: %v", key, envVars[key])
           here needed a new one with json.marshalIdent
   }
  </code></pre>
  
  <p>I never used go so I really do not know which one to use and how.</p>