Rest API: Have Spin Json variables return as actual Json rather than Stringified Json

Is there any specific reasons for Json Spin object to not be returned as proper json when getting a variable from the rest API?

Currently they are returned as stringified json (a string).

Thanks!

@thorben

Hi Stephen,

Do you mean a Java object that is serialized via Spin (i.e. value of type object) or a native Json value (value of type json)?

Cheers,
Thorben

@thorben i am talking about Spin JSON. When you use deserializeValues = false you only get a String of the JSON, which then requires further parsing by the client of the API. would be great if we could have the server return this as a proper parsed json object.

Where currently a response would look something like this:

[
    {
        "type": "Json",
        "value": "{\"sid\":\"...\",\"date_created\":\"Fri, 17 Nov 2017 21:50:13 +0000\",\"date_updated\":\"Fri, 17 Nov 2017 21:50:13 +0000\",\"date_sent\":null,\"account_sid\":\"...\",\"to\":\"....\",\"from\":\"...\",\"messaging_service_sid\":null,\"body\":\"This is a test message\",\"status\":\"queued\",\"num_segments\":\"1\",\"num_media\":\"0\",\"direction\":\"outbound-api\",\"api_version\":\"2010-04-01\",\"price\":null,\"price_unit\":\"USD\",\"error_code\":null,\"error_message\":null,\"uri\":\"....\",\"subresource_uris\":{\"media\":\"/....\"}}",
        "valueInfo": {},
        "id": "4a322682-cbe1-11e7-b1ea-0242ac110002",
        "name": "responseBody",
        "processInstanceId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "executionId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "caseInstanceId": null,
        "caseExecutionId": null,
        "taskId": null,
        "activityInstanceId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "errorMessage": null,
        "tenantId": null
    }
]

and would be great if we could get something like this:

[
    {
        "type": "Json",
        "value": {
            "sid": "...",
            "date_created": "Fri, 17 Nov 2017 21:50:13 +0000",
            "date_updated": "Fri, 17 Nov 2017 21:50:13 +0000",
            "date_sent": null,
            "account_sid": "...",
            "to": "...",
            "from": "...",
            "messaging_service_sid": null,
            "body": "This is a test message",
            "status": "queued",
            "num_segments": "1",
            "num_media": "0",
            "direction": "outbound-api",
            "api_version": "2010-04-01",
            "price": null,
            "price_unit": "USD",
            "error_code": null,
            "error_message": null,
            "uri": "...",
            "subresource_uris": {
                "media": "..."
            }
        },
        "valueInfo": {},
        "id": "4a322682-cbe1-11e7-b1ea-0242ac110002",
        "name": "responseBody",
        "processInstanceId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "executionId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "caseInstanceId": null,
        "caseExecutionId": null,
        "taskId": null,
        "activityInstanceId": "4a0e4ace-cbe1-11e7-b1ea-0242ac110002",
        "errorMessage": null,
        "tenantId": null
    }
]

Hi Stephen,

Thanks for the example. I agree that proper JSON would be nicer for this variable type. At the same time, I’m not sure how to change that in a backwards-compatible way that would not overcomplicate things. Do you have an idea for that?

Cheers,
Thorben

Could it be a additional optional parameter ? Like a “format” or “parse” parameter?

Hey Stephen,

Feel free to raise a feature request in JIRA.

Cheers,
Thorben

https://app.camunda.com/jira/browse/CAM-8466