ORDS: Returning Raw {JSON}

thatjeffsmith ORDS 0 Comments

Tell Others About This Story:

ORDS is nice.

It auto-formats your SQL or PL/SQL results and response to JSON before returning to your client or application.

But what if you’re response is ALREADY in JSON?

Like this:

Oracle can be your JSON DB, seriously.

Bad

ORDS trying to convert JSON to JSON

Yuck.

Good

You telling ORDS we’re not just dealing with a CLOB, it’s actually JSON.

We’ve talked about the MEDIA stuff before.

Here’s that media post…
The Media resource in this case is application/json – and we’re going to let the browser handle that, just like it would a BLOB and a PDF. We just need to include the heads-up notice saying what it actually is, so adjust your GET query text to include ‘application/json’ before you include the JSON itself.

Ta-da!

Tell Others About This Story:

Leave a Reply

Your email address will not be published. Required fields are marked *