HTTP input json parsing

If the content-type is 'application/json' then the http input node emits a JS object. Is it possible to
specify that other content-types also do this? Specifically I'd like to use 'application/json+fhir' to provide
FHIR ( compatible end-points...

Is it that you want to validate the content of the JSON or for some other reason?

The problem I think is that there are potentially an infinite number of such formats - how could Node-RED deal with them all directly? There are, however, ways of validating the structure of the JSON once you have it by checking the schema.

No, it's because FHIR (A healthcare interoperability standard) uses that mime type to indicate that the contents are a FHIR resource in Json format. In effect, I'd like the HTTP node to emit a javascript object in the same way as it does for a content-type of application/json...

Reading their documentation: it is still json as per rfc.
But ok, you can use the http request node and specify the mime content/type header

Sadly, their example JSON file isn't served via 'application/json+fhir' but as Backman2 says, if you are requesting the file via the http-request node, the content type should, I think be in the msg.res from what is returned.

If you have an example we can get an API response from with the correct mime return, I'd be happy to test that.

In fact:

[{"id":"c1195b1d.09f1e8","type":"inject","z":"63281c77.40a064","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":480,"wires":[["5c0841f5.8ad83"]]},{"id":"676239f7.49a018","type":"debug","z":"63281c77.40a064","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":580,"y":480,"wires":[]},{"id":"5c0841f5.8ad83","type":"http request","z":"63281c77.40a064","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","proxy":"","authType":"basic","x":400,"y":480,"wires":[["676239f7.49a018"]]}]

The content-type is here msg.headers["content-type"] - Just note that you will need to extract the mime type from the content-type string.

I think you have this backwards... the OP was asking if the http input node can handle it - not the http request node.

In the settings.js file you can add your own httpNodeMiddleware: function that gets called before the built in json handler - so you could call bodyParser there with the correct header type set.

In theory we could possibly change the default type (for the json parser) to be application/json* with a wildcard - but I don't know the implications of that, so not going to jump right in. Also I saw this - so need to be sure which way that got resolved before we change anything in core... and indeed their spec does say it is application/fhir+json - see

Thanks @dceejay - will try that. The reference you made to the hapi blog was that the mime type was changed between release 2 & 3 of the standard (it's still evolving). Now it's application/fhir+json (had it the wrong way in my original post - sorry about that) -