Replies: 5 comments
-
There's --write-out "%{json}" but that only (mostly) gets you the metadata about the transfer in JSON. The actual headers are returned in HTTP format only.
|
Beta Was this translation helpful? Give feedback.
-
Yes i saw it but For now I parse the header on my own (its not complicated but there is only 99% safety that everything is correct.) |
Beta Was this translation helpful? Give feedback.
-
While curl parses each header enough to look at the header name, it doesn't
parse the header data except for a few that it cares about. So, all you
could expect from curl if it were to provide a generic JSON format header
structure is a (name, value) set for each header. But, that's trivial to do in
an application so there's not much value in adding this feature. But, if it
were added, it needs documentation, testing and the overhead in keeping the
feature working in the face of code refactoring and code changes. So, it's not
free to add this, even if curl does some of the work already.
|
Beta Was this translation helpful? Give feedback.
-
You are absolutely right. It was just an idea to offload these things to curl itself to get 100% reliable informations and in case of a change, its only a change in one place not in many curl depending systems. But I didnt thought on the price for it. |
Beta Was this translation helpful? Give feedback.
-
just in case somebody stumbled upon this: |
Beta Was this translation helpful? Give feedback.
-
Hello,
Im using CURL in a script and receive the http header to the stderr (reading stderr by my script). I try to find a option to receive the response header as a JSON object but unfortunately i couldnt find any option and so i wrote a parser for it. But i think it would be more nice to receive a JSON with all the information (as example information like i receive on curl_getinfo in php), as curl anyway need to parse the header information to work on them (and so a wrong parsing could be avoided)
maybe there is already such a option but i missed it. Reading the docs i couldnt find it.
regards
Beta Was this translation helpful? Give feedback.
All reactions