{"id":924,"date":"2016-01-26T21:39:43","date_gmt":"2016-01-26T20:39:43","guid":{"rendered":"http:\/\/monodes.com\/predaelli\/?p=924"},"modified":"2016-01-26T15:31:36","modified_gmt":"2016-01-26T14:31:36","slug":"json-references","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2016\/01\/26\/json-references\/","title":{"rendered":"JSON references"},"content":{"rendered":"<blockquote><p>Is there a standard way of referencing objects by identity in JSON? For example, so that graphs and other data structures with lots of (possibly circular) references can be sanely serialized\/loaded?<\/p><\/blockquote>\n<p>From: <em><a href=\"http:\/\/stackoverflow.com\/questions\/4001474\/json-standard-way-of-referencing-an-object-by-identity-for-eg-circular-refer\">JSON: Standard way of referencing an object by identity (for, eg, circular references)? &#8211; Stack Overflow<\/a><\/em><\/p>\n<p><!--more--><\/p>\n<p>Then there&#8217;s an <a href=\"https:\/\/tools.ietf.org\/html\/draft-pbryan-zyp-json-ref-03\">expired yet interesting Internet-Draft<\/a> used in <a href=\"http:\/\/json-schema.org\/\" rel=\"nofollow\">JSON Schema<\/a> and <a href=\"http:\/\/swagger.io\/specification\/#referenceObject\" rel=\"nofollow\">Swagger<\/a> and a <a href=\"http:\/\/json-spec.readthedocs.org\/en\/latest\/reference.html\">Python module<\/a> giving us this example:<\/p>\n<blockquote><p><span class=\"p\">{<\/span><br \/><span class=\"s2\">&#8220;foo&#8221;<\/span><span class=\"o\">:<\/span> <span class=\"p\">{<\/span><span class=\"s2\">&#8220;$ref&#8221;<\/span><span class=\"o\">:<\/span> <span class=\"s2\">&#8220;#\/bar&#8221;<\/span><span class=\"p\">},<\/span><br \/><span class=\"s2\">&#8220;bar&#8221;<\/span><span class=\"o\">:<\/span> <span class=\"kc\">true<br \/><\/span> <span class=\"p\">}<\/span><\/p><\/blockquote>\n<p>that would be resolved as:<\/p>\n<blockquote>\n<pre><span class=\"p\">{<\/span>\n  <span class=\"s2\">\"foo\"<\/span><span class=\"o\">:<\/span> <span class=\"kc\">true<\/span><span class=\"p\">,<\/span>\n  <span class=\"s2\">\"bar\"<\/span><span class=\"o\">:<\/span> <span class=\"kc\">true<\/span>\n<span class=\"p\">}<\/span><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Is there a standard way of referencing objects by identity in JSON? For example, so that graphs and other data structures with lots of (possibly circular) references can be sanely serialized\/loaded? From: JSON: Standard way of referencing an object by identity (for, eg, circular references)? &#8211; Stack Overflow<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2016\/01\/26\/json-references\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[50],"tags":[84],"class_list":["post-924","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-json"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-eU","jetpack-related-posts":[{"id":15394,"url":"https:\/\/monodes.com\/predaelli\/2026\/03\/29\/nobody-gets-fired-for-picking-json-but-maybe-they-should\/","url_meta":{"origin":924,"position":0},"title":"Nobody Gets Fired for Picking JSON, but Maybe They Should?","author":"Paolo Redaelli","date":"2026-03-29","format":"link","excerpt":"Nobody Gets Fired for Picking JSON, but Maybe They Should? By Miguel Young de la Sota Nobody Gets Fired for Picking JSON, but Maybe They Should? JSON is extremely popular but deeply flawed. This article discusses the details of JSON\u2019s design, how it\u2019s used (and misused), and how seemingly helpful\u2026","rel":"","context":"In &quot;Javascript&quot;","block_context":{"text":"Javascript","link":"https:\/\/monodes.com\/predaelli\/category\/javascript\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11513,"url":"https:\/\/monodes.com\/predaelli\/2024\/03\/24\/duckdb-as-the-new-jq\/","url_meta":{"origin":924,"position":1},"title":"DuckDB as the New jq","author":"Paolo Redaelli","date":"2024-03-24","format":"quote","excerpt":"Recently, I\u2019ve been interested in the DuckDB project (like a SQLite geared towards data applications). And one of the amazing features is that it has many data importers included without requiring extra dependencies. This means it can natively read and parse JSON as a database table, among many other formats.\u2026","rel":"","context":"In &quot;Software Libero&quot;","block_context":{"text":"Software Libero","link":"https:\/\/monodes.com\/predaelli\/category\/software\/software-libero\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9401,"url":"https:\/\/monodes.com\/predaelli\/2022\/05\/26\/the-simdjson-library\/","url_meta":{"origin":924,"position":2},"title":"The simdjson library","author":"Paolo Redaelli","date":"2022-05-26","format":false,"excerpt":"The simdjson library Parsing gigabytes of JSON per second JSON is everywhere on the Internet. Servers spend a lot of time parsing it. The simdjson library uses commonly available SIMD instructions and microparallel algorithms to break speed records.","rel":"","context":"In &quot;Agenda&quot;","block_context":{"text":"Agenda","link":"https:\/\/monodes.com\/predaelli\/category\/agenda\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":15395,"url":"https:\/\/monodes.com\/predaelli\/2026\/03\/29\/protobuf-advolvendum-est\/","url_meta":{"origin":924,"position":3},"title":"ProtoBuf advolvendum est","author":"Paolo Redaelli","date":"2026-03-29","format":false,"excerpt":"The proficient Miguel Young de la Sota suggests to use Protocol Buffers1 instead of JSON in his article \"Nobody Gets Fired for Picking JSON, but Maybe They Should?\" I shall add to my advolvenda2","rel":"","context":"In &quot;Advolvenda&quot;","block_context":{"text":"Advolvenda","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/liberty-eiffel\/advolvenda\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8667,"url":"https:\/\/monodes.com\/predaelli\/2021\/09\/08\/useful-tools\/","url_meta":{"origin":924,"position":4},"title":"Useful tools","author":"Paolo Redaelli","date":"2021-09-08","format":false,"excerpt":"htmlq, like jq, but for HTML. Uses CSS selectors to extract bits content from HTML files. Mozilla's MDN has a good reference for CSS selector syntax. jq is a lightweight and flexible command-line JSON processor.","rel":"","context":"In &quot;Software Libero&quot;","block_context":{"text":"Software Libero","link":"https:\/\/monodes.com\/predaelli\/category\/software\/software-libero\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12034,"url":"https:\/\/monodes.com\/predaelli\/2024\/11\/13\/12034\/","url_meta":{"origin":924,"position":5},"title":"Underscore is a JavaScript library\u2026","author":"Paolo Redaelli","date":"2024-11-13","format":false,"excerpt":"Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It\u2019s the answer to the question: \u201cIf I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?\u201d \u2026 and\u2026","rel":"","context":"In &quot;Javascript&quot;","block_context":{"text":"Javascript","link":"https:\/\/monodes.com\/predaelli\/category\/javascript\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=924"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/924\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}