mulesoft/api-designer

How can I create a key named value?

partounian opened this issue · 6 comments

I have a json response that looks like

{
    name: "ui.fgcolor",
    value: "#FFFFFF",
    createdTime: "2016-10-19T02:20:33.601Z"
}

but with the key named value, I can only see "#FFFFFF" with the color blue in the preview of api designer?

EDIT:
However, the below json works fine.

{
  "items": [
    {
      "name": "ui.fgcolor",
      "value": "#FFFFFF",
      "createdTime": "2016-10-19T02:20:33.601Z"
    }
  ]
}

You forgot double quotes which are important in JSON:

{
  "name": "ui.fgcolor",
  "value": "#FFFFFF",
  "createdTime": "2016-10-19T02:20:33.601Z"
}

@sichvoge I apologise I forgot to mention that I already tried that.

It's working for me and everything is rendering just fine. So can you explain a little bit more what you are seeing? Maybe add an image to clarify things more for us.

I went and double checked adding double quotes to no avail.
Here is what I see in api-designer and api-console.
image

what version do you use, thats what i see using 0.4.1

image

my RAML:

#%RAML 1.0
title: gfg

/resur:
  get:
    responses: 
      200:
        body: 
          application/json:
            example: |
              {
                "name": "ui.fgcolor",
                "value": "#FFFFFF",
                "createdTime": "2016-10-19T02:20:33.601Z"
              }

Okay so adding the double quotes and the | fixes it.