1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Long: json 5Arg: <data> 6Help: HTTP POST JSON 7Protocols: HTTP 8Mutexed: form head upload-file 9Category: http post upload 10Added: 7.82.0 11Multi: append 12See-also: 13 - data-binary 14 - data-raw 15Example: 16 - --json '{ "drink": "coffe" }' $URL 17 - --json '{ "drink":' --json ' "coffe" }' $URL 18 - --json @prepared $URL 19 - --json @- $URL < json.txt 20--- 21 22# `--json` 23 24Sends the specified JSON data in a POST request to the HTTP server. --json 25works as a shortcut for passing on these three options: 26 27 --data-binary [arg] 28 --header "Content-Type: application/json" 29 --header "Accept: application/json" 30 31There is **no verification** that the passed in data is actual JSON or that 32the syntax is correct. 33 34If you start the data with the letter @, the rest should be a filename to read 35the data from, or a single dash (-) if you want curl to read the data from 36stdin. Posting data from a file named 'foobar' would thus be done with --json 37@foobar and to instead read the data from stdin, use --json @-. 38 39If this option is used more than once on the same command line, the additional 40data pieces are concatenated to the previous before sending. 41 42The headers this option sets can be overridden with --header as usual. 43