添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
不敢表白的芒果  ·  如何使用EV ...·  4 月前    · 
开心的登山鞋  ·  ThreeJS中的材质·  1 年前    · 
温柔的筷子  ·  MQTT Host name ...·  1 年前    · 
魁梧的汉堡包  ·  Support·  1 年前    · 

Thanks for the question.

Asked: March 06, 2019 - 8:10 pm UTC

Last updated: March 06, 2019 - 8:10 pm UTC

Version:

Viewed 10K+ times! This question is

You Asked

Hi Beda,

What is the added value of JSON_SERIALIZE(expr) compared to JSON_QUERY(expr, '$')? Are there significant differences in the actual code executed underneath? Thanks in advance, Stew Ashton

and we said...

Hi Stew,

JSON_QUERY with path expression '$' is almost equivalent to JSON_SERIALIZE but will still evaluate the path expression '$' using the path engine (i.e. will be a little bit slower). JSON_QUERY also has some options that JSON_SERIALIZE does not have like EMPTY OBJECT ON ERROR and similar.

Rating

(2 ratings)
Is this answer out of date? If it is, please let us know via a Comment ....
If you prefer formatted output, use JSON_SERIALIZE(expr PRETTY)
....


However since 12.2 JSON_QUERY also support the PRETTY formatting of JSON documents.

demo@ORA12C> select data from json_documents ;
------------------------------------------------------------
{"id":1,"first_name":"Iron","last_name":"Man"}
demo@ORA12C> select json_query( data, '$' pretty ) from json_documents;
JSON_QUERY(DATA,'$'PRETTY)
-----------------------------------------------------------------------------
  "id" : 1,
  "first_name" : "Iron",
  "last_name" : "Man"
demo@ORA12C>