dify icon indicating copy to clipboard operation
dify copied to clipboard

Unable to use `Array[String]` in `HTTP Request`

Open AprilNEA opened this issue 1 year ago • 4 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

Live

Cloud or Self Hosted

Cloud

Steps to reproduce

image image image

✔️ Expected Behavior

image

❌ Actual Behavior

image

AprilNEA avatar Oct 09 '24 10:10 AprilNEA

Workflow App: https://udify.app/workflow/UvtkopWluBtN4Ekw

AprilNEA avatar Oct 09 '24 10:10 AprilNEA

The issue you're encountering with the "Unexpected token" error is likely due to the use of single quotes in your JSON input. JSON requires double quotes for strings.

To resolve this, ensure that your JSON body in the HTTP request is formatted with double quotes, like this:

{
  "result": ["1", "2"]
}

Make sure your request body is correctly set up in the HTTP request configuration interface. If you're using a variable, ensure it outputs the JSON in the correct format with double quotes.

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Oct 09 '24 10:10 dosubot[bot]

The issue you're encountering with the "Unexpected token" error is likely due to the use of single quotes in your JSON input. JSON requires double quotes for strings.

To resolve this, ensure that your JSON body in the HTTP request is formatted with double quotes, like this:

{
  "result": ["1", "2"]
}

Make sure your request body is correctly set up in the HTTP request configuration interface. If you're using a variable, ensure it outputs the JSON in the correct format with double quotes.

To continue talking to Dosu, mention @dosu.

@docu That's the crux of the problem, but obviously it's not in the user's control

AprilNEA avatar Oct 09 '24 10:10 AprilNEA

This is a known issue, we plan to support it later.

crazywoola avatar Oct 09 '24 13:10 crazywoola

Hi, @AprilNEA. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You reported a bug in the cloud-hosted version of Dify involving Array[String] in an HTTP Request.
  • I suggested the issue might be due to incorrect JSON formatting with single quotes.
  • You acknowledged this but noted the problem is not user-controllable.
  • Crazywoola confirmed it's a known issue and mentioned future support is planned.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of Dify by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Nov 09 '24 16:11 dosubot[bot]

I encounter the same issue in version 0.11.0. Is this issue got fixed in latest version?

yunchi0921 avatar Dec 30 '24 07:12 yunchi0921

I encounter the same issue in version 0.15.3, how can i use jsonarray in post body like [{"name": "jack", "age": 20}, {"name": "alice", "age": 18}]

phoenixor avatar May 24 '25 08:05 phoenixor