4D Blog

Home Product Working with JSON Pointers

Working with JSON Pointers

October 30, 2017

Product 4D v16 R5 supports the JSON pointers

In 4D v16 R4, we enriched object commands so you can validate JSON objects. 4D v16 R5 is going even further by introducing the support of JSON pointers. Great – but what is a JSON pointer and what can I do with it?

Just like you don’t store company details for each employee in a database record (using a link to the company record instead), it can be really useful to structure a JSON document with parts that can be reused in a number of places.

For instance, let’s take an example of a website order; the customer enters the shipping address and designates the billing address as the same. Instead of duplicating the address information, we can define the shipping address as a reference to the the billing address.

Another scenario is to define a template object containing default properties stored in JSON format and merges some of the properties with information stored in a separate JSON file.

Objects that contain cycles (i.e. two objects that contain each other) cannot be stringified in JSON. JSON pointers are a way to express the cyclic reference while maintaining compatibility with the JSON format.

JSON Pointer CONCEPT

JSON Pointer is a standard which defines a string syntax that can be used to access a particular field or key value in the same or another JSON document. It’s made up of strings separated by the “/” character. These strings either specify keys in objects or indexes in arrays. The JSON pointer syntax is defined by RFC 6901.

For example, this object:

{
    "foo": {"$ref": "#/bar"},
    "bar": "42"
}

Can be resolved as:

{
   "foo": "42",
   "bar": "42"
}

NEW COMMAND

The JSON resolve pointers command analyzes all the JSON pointers found in the object passed as parameter with regards to some options settings (if any). The command then returns an object with the success status, the result value and the potential list of errors.

A FEW Examples… it’s always helpful!

Check out our example database demo to learn (and understand) more about how JSON pointers work!

Database example

In addition to the demo, here’s another example – let’s take an $object variable which contains the following:

If I run the code below:

$result:=JSON Resolve pointers($object)
TRACE

Here’s what I get in the $object and $result variables:

blank

Note that $result is an object, containing both the success status and the returned value. If there had been any errors, they’d have been included, too.

Discuss

Tags JSON, Objects, Programming, v16 R5, v17

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy