json.d 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. Long: json
  2. Arg: <data>
  3. Help: HTTP POST JSON
  4. Protocols: HTTP
  5. See-also: data-binary data-raw
  6. Mutexed: form head upload-file
  7. Category: http post upload
  8. Example: --json '{ "drink": "coffe" }' $URL
  9. Example: --json '{ "drink":' --json ' "coffe" }' $URL
  10. Example: --json @prepared $URL
  11. Example: --json @- $URL < json.txt
  12. Added: 7.82.0
  13. ---
  14. Sends the specified JSON data in a POST request to the HTTP server. --json
  15. works as a shortcut for passing on these three options:
  16. --data [arg]
  17. --header "Content-Type: application/json"
  18. --header "Accept: application/json"
  19. There is **no verification** that the passed in data is actual JSON or that
  20. the syntax is correct.
  21. If you start the data with the letter @, the rest should be a file name to
  22. read the data from, or a single dash (-) if you want curl to read the data
  23. from stdin. Posting data from a file named \&'foobar' would thus be done with
  24. --json @foobar and to instead read the data from stdin, use --json @-.
  25. If this option is used more than once on the same command line, the additional
  26. data pieces will be concatenated to the previous before sending.
  27. The headers this option sets can be overridden with --header as usual.