Support » Plugin: Rest Routes – Custom Endpoints for WP REST API » 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/”,
    “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 WP Making

    (@wp-making)

    Hello,

    Nice to see you are enjoying it!

    So you have 4 custom fields and want to nest 3 into “color”?

    Thread Starter djangossoul

    (@djangossoul)

    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.