spring-cloud-dataflow icon indicating copy to clipboard operation
spring-cloud-dataflow copied to clipboard

JSON parse error in POST tools/parseTaskTextToGraph

Open Asinrus opened this issue 2 years ago • 3 comments
trafficstars

Hello, everyone

I created by UI a task definiton :a: http-experiment --body='{"params": {"val1": ${val2}}' ,where http-experiment is an application with metadata, where --body is setted in org.springframework.cloud.dataflow.spring-configuration-metadata.json.

I have an issue with a endpoint: POST tools/parseTaskTextToGraph I get a error:

{
  "_embedded": {
    "errors": [
      {
        "message": "JSON parse error: Unexpected character ('p' (code 112)): was expecting comma to separate Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('p' (code 112)): was expecting comma to separate Object entries\n at [Source: (PushbackInputStream); line: 1, column: 39]",
        "logref": "HttpMessageNotReadableException",
        "_links": {
          "self": {
            "href": "/"
          }
        }
      }
    ]
  }
}

Could you say, please, it is correct behaviour?

Additional context: Spring Cloud DataFlow version: 2.9.1

Asinrus avatar Mar 10 '23 14:03 Asinrus

Try escaping the " like in `--body="{\"params\": {\"val1\": ${val2}}"

corneil avatar Mar 10 '23 14:03 corneil

So, I didn't get a result I made next definition a: http-experiment --body="{\"params\": {\"val_1\": ${val_1}}" I get

{
  "_embedded": {
    "errors": [
      {
        "message": "JSON parse error: Unexpected character ('{' (code 123)): was expecting comma to separate Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('{' (code 123)): was expecting comma to separate Object entries\n at [Source: (PushbackInputStream); line: 1, column: 38]",
        "logref": "HttpMessageNotReadableException",
        "_links": {
          "self": {
            "href": "/"
          }
        }
      }
    ]
  }
}

Moreover, my definition was rewritten to a: http-experiment --body='"{\"params\": {\"val_1\": ${val_1}}"'.

Asinrus avatar Mar 13 '23 06:03 Asinrus

a: http-experiment --body="{\"params\": {\"val_1\": ${val_1}}" ${val_1} is recursive and that is going to cause problems. What happens with a: http-experiment --body="{\"params\": {\"val_1\": \"value_1\"}}"?

corneil avatar Dec 22 '23 14:12 corneil

Closing due to inactivity. If closed in error please let us know.

cppwfs avatar Jul 22 '24 14:07 cppwfs