Title: Nested variables in JSON
Last modified: November 12, 2017

---

# Nested variables in JSON

 *  [djangossoul](https://wordpress.org/support/users/djangossoul/)
 * (@djangossoul)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/nested-variables-in-json/)
 * Hi!
    First I would thank you for this plugin, which seem perfect for my needs(
   a WP backend + a React frontend), particularly delightful with Custom Post Type(
   CPT UI plugin) and Advanced Custom Field (ACF plugin) Only I am wondering if 
   it’s possible to get this kind of nested response (see “color” below)
 * {
    “ID”: “68”, “title”: “Home”, “url”: “[http://wp.mywebsite/home/&#8221](http://wp.mywebsite/home/&#8221);,“
   slug”: “home”, “type”: “page”, “color”: { “bg”: “#6114cc”, “primary”: “#f8f8f8”,“
   secondary”: “” } },
 * I am currently able to have: “color”: “1” although “color” is designed to contain“
   bg”, “primary” and “secondary”
 * Thank in advance for your help!
    Cheers Guillaume (And I’m definitely volunteer
   to participate to your beta version if any 😉 )

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Rest Routes](https://wordpress.org/support/users/wp-making/)
 * (@wp-making)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/nested-variables-in-json/#post-9740881)
 * Hello,
 * Nice to see you are enjoying it!
 * So you have 4 custom fields and want to nest 3 into “color”?
 *  Thread Starter [djangossoul](https://wordpress.org/support/users/djangossoul/)
 * (@djangossoul)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/nested-variables-in-json/#post-9859349)
 * Hello!
    So sorry for the delay… (a personal project, so was not a high priority
   😉
 * Yes exactly! I want to know how to nest custom fields into another one.
 * Thanks for your help
    G

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Nested variables in JSON’ is closed to new replies.

 * ![](https://ps.w.org/rest-routes/assets/icon-128x128.png?rev=1337282)
 * [Rest Routes – Custom Endpoints for WordPress REST API](https://wordpress.org/plugins/rest-routes/)
 * [Support Threads](https://wordpress.org/support/plugin/rest-routes/)
 * [Active Topics](https://wordpress.org/support/plugin/rest-routes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rest-routes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rest-routes/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [djangossoul](https://wordpress.org/support/users/djangossoul/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/nested-variables-in-json/#post-9859349)
 * Status: not resolved