An error is reported when the Array[String] parameter of dify is used as http json #7762

Closed
opened 2026-02-21 18:22:15 -05:00 by yindo · 11 comments
Owner

Originally created by @justify-what on GitHub (Jan 16, 2025).

Self Checks

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

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

An error is reported when the Array[String] parameter of dify is used as http json

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @justify-what on GitHub (Jan 16, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.14.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce An error is reported when the Array[String] parameter of dify is used as http json ![Image](https://github.com/user-attachments/assets/c60c120b-49a0-4ce3-97dd-8139d598b3be) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 18:22:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 16, 2025):

Hello, @justify-what! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue.

To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the executor.py file located at /api/core/workflow/nodes/http_request/executor.py. Change the line:

json_object = json.loads(json_string, strict=False)

to:

json_object = json.loads(json_string.replace("'", '"'), strict=False)

This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 16, 2025): <!-- Greeting --> Hello, @justify-what! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue. <!-- Answer --> To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the `executor.py` file located at `/api/core/workflow/nodes/http_request/executor.py`. Change the line: ```python json_object = json.loads(json_string, strict=False) ``` to: ```python json_object = json.loads(json_string.replace("'", '"'), strict=False) ``` This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 <sup>[[1]](https://github.com/langgenius/dify/issues/12759)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=other)</sup>
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

It still doesn't work.

Image

@justify-what commented on GitHub (Jan 16, 2025): It still doesn't work. ![Image](https://github.com/user-attachments/assets/8aec611d-8789-4e38-a5f9-1e7076019f22)
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

and I'm using the docker version

@justify-what commented on GitHub (Jan 16, 2025): and I'm using the docker version
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

Hello, @justify-what! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue.

To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the executor.py file located at /api/core/workflow/nodes/http_request/executor.py. Change the line:

json_object = json.loads(json_string, strict=False)
to:

json_object = json.loads(json_string.replace("'", '"'), strict=False)
This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 [1].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

and I'm using the docker version

@justify-what commented on GitHub (Jan 16, 2025): > Hello, [@justify-what](https://github.com/justify-what)! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue. > > To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the `executor.py` file located at `/api/core/workflow/nodes/http_request/executor.py`. Change the line: > > json_object = json.loads(json_string, strict=False) > to: > > json_object = json.loads(json_string.replace("'", '"'), strict=False) > This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 [[1]](https://github.com/langgenius/dify/issues/12759). > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=other) and I'm using the docker version
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

Hello, @justify-what! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue.

To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the executor.py file located at /api/core/workflow/nodes/http_request/executor.py. Change the line:

json_object = json.loads(json_string, strict=False)
to:

json_object = json.loads(json_string.replace("'", '"'), strict=False)
This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 [1].

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

and I'm using the docker version @dosu.

@justify-what commented on GitHub (Jan 16, 2025): > Hello, [@justify-what](https://github.com/justify-what)! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue. > > To resolve the 'Invalid JSON string' error when using the Array[String] parameter of Dify as HTTP JSON, you can modify the `executor.py` file located at `/api/core/workflow/nodes/http_request/executor.py`. Change the line: > > json_object = json.loads(json_string, strict=False) > to: > > json_object = json.loads(json_string.replace("'", '"'), strict=False) > This modification converts single-quoted strings to JSON-compatible double-quoted strings, which should resolve the JSON parsing error. This solution is applicable for Dify version 0.15.1, but it might also work for version 0.14.2 [[1]](https://github.com/langgenius/dify/issues/12759). > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/79f09b7c-46d3-4550-b592-cb95dcb67da6?feedback_type=other) and I'm using the docker version @dosu.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 16, 2025):

To address the JSON parsing error you're encountering, ensure that the JSON input is correctly formatted. The error message "Expecting value: line 2 column 17 (char 18)" suggests there might be an issue with the JSON structure or the way special characters are handled.

  1. Check JSON Formatting: Make sure the JSON input is properly formatted with double quotes around keys and string values. For example:

    {
      "shopIdList": ["id1", "id2"],
      "token": "your_token_here"
    }
    
  2. Modify JSON Handling in Code: If the issue persists, ensure that the json.loads and json.dumps functions are used correctly in your Python code. The json.loads function should be used to parse JSON strings, and json.dumps should be used to convert Python objects to JSON strings.

  3. Docker Configuration: Since you're using the Docker version, ensure that any changes to the code are reflected in the Docker container. After making changes, restart the Docker containers to apply them:

    docker compose down
    docker compose up -d
    
  4. Environment Variables: Verify that the environment variables in your Docker setup are correctly configured, especially those related to JSON handling, if any.

If these steps do not resolve the issue, consider checking the logs for more detailed error messages that might provide additional insights into the problem.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 16, 2025): <!-- Answer --> To address the JSON parsing error you're encountering, ensure that the JSON input is correctly formatted. The error message "Expecting value: line 2 column 17 (char 18)" suggests there might be an issue with the JSON structure or the way special characters are handled. 1. **Check JSON Formatting**: Make sure the JSON input is properly formatted with double quotes around keys and string values. For example: ```json { "shopIdList": ["id1", "id2"], "token": "your_token_here" } ``` 2. **Modify JSON Handling in Code**: If the issue persists, ensure that the `json.loads` and `json.dumps` functions are used correctly in your Python code. The `json.loads` function should be used to parse JSON strings, and `json.dumps` should be used to convert Python objects to JSON strings. 3. **Docker Configuration**: Since you're using the Docker version, ensure that any changes to the code are reflected in the Docker container. After making changes, restart the Docker containers to apply them: ```bash docker compose down docker compose up -d ``` 4. **Environment Variables**: Verify that the environment variables in your Docker setup are correctly configured, especially those related to JSON handling, if any. If these steps do not resolve the issue, consider checking the logs for more detailed error messages that might provide additional insights into the problem. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/05e24694-ef7d-4974-b08b-72437d937fb3?feedback_type=other)</sup>
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

4. Verify that the environment variables in your Docker setup are correctly configured, especially those related to JSON handling, if any.

I mean, the modification executor.py file you mentioned in the previous step, I am deployed in the docker version, I can't modify the source code, is there any other way to modify it, and the json format is correct
@dosu.

@justify-what commented on GitHub (Jan 16, 2025): > 4\. Verify that the environment variables in your Docker setup are correctly configured, especially those related to JSON handling, if any. I mean, the modification executor.py file you mentioned in the previous step, I am deployed in the docker version, I can't modify the source code, is there any other way to modify it, and the json format is correct @dosu.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 16, 2025):

To modify the behavior of Dify's Docker deployment without directly altering the source code, you can use Docker's volume mounting feature to override specific files. Here's how you can do it:

  1. Create a Local Copy of the File: First, create a local copy of the executor.py file that you want to modify. You can do this by copying the file from the running Docker container to your local machine.

  2. Modify the Local Copy: Make the necessary changes to your local copy of executor.py, such as replacing single quotes with double quotes in JSON strings.

  3. Mount the Modified File: Use Docker's volume mounting feature to replace the original file in the container with your modified version. You can do this by adding a volume mount to your docker-compose.yaml file:

    services:
      your_service_name:
        volumes:
          - ./path/to/your/local/executor.py:/path/in/container/executor.py
    

    Replace your_service_name with the name of the service running Dify, ./path/to/your/local/executor.py with the path to your modified file, and /path/in/container/executor.py with the path to the original file in the container.

  4. Restart the Docker Containers: After updating the docker-compose.yaml file, restart your Docker containers to apply the changes:

    docker compose down
    docker compose up -d
    

This approach allows you to customize the behavior of Dify without directly modifying the source code within the Docker image.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 16, 2025): <!-- Answer --> To modify the behavior of Dify's Docker deployment without directly altering the source code, you can use Docker's volume mounting feature to override specific files. Here's how you can do it: 1. **Create a Local Copy of the File**: First, create a local copy of the `executor.py` file that you want to modify. You can do this by copying the file from the running Docker container to your local machine. 2. **Modify the Local Copy**: Make the necessary changes to your local copy of `executor.py`, such as replacing single quotes with double quotes in JSON strings. 3. **Mount the Modified File**: Use Docker's volume mounting feature to replace the original file in the container with your modified version. You can do this by adding a volume mount to your `docker-compose.yaml` file: ```yaml services: your_service_name: volumes: - ./path/to/your/local/executor.py:/path/in/container/executor.py ``` Replace `your_service_name` with the name of the service running Dify, `./path/to/your/local/executor.py` with the path to your modified file, and `/path/in/container/executor.py` with the path to the original file in the container. 4. **Restart the Docker Containers**: After updating the `docker-compose.yaml` file, restart your Docker containers to apply the changes: ```bash docker compose down docker compose up -d ``` This approach allows you to customize the behavior of Dify without directly modifying the source code within the Docker image. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=other)</sup>
Author
Owner

@justify-what commented on GitHub (Jan 16, 2025):

To modify the behavior of Dify's Docker deployment without directly altering the source code, you can use Docker's volume mounting feature to override specific files. Here's how you can do it:

  1. Create a Local Copy of the File: First, create a local copy of the executor.py file that you want to modify. You can do this by copying the file from the running Docker container to your local machine.

  2. Modify the Local Copy: Make the necessary changes to your local copy of executor.py, such as replacing single quotes with double quotes in JSON strings.

  3. Mount the Modified File: Use Docker's volume mounting feature to replace the original file in the container with your modified version. You can do this by adding a volume mount to your docker-compose.yaml file:
    services:
    your_service_name:
    volumes:
    - ./path/to/your/local/executor.py:/path/in/container/executor.py

    Replace your_service_name with the name of the service running Dify, ./path/to/your/local/executor.py with the path to your modified file, and /path/in/container/executor.py with the path to the original file in the container.

  4. Restart the Docker Containers: After updating the docker-compose.yaml file, restart your Docker containers to apply the changes:
    docker compose down
    docker compose up -d

This approach allows you to customize the behavior of Dify without directly modifying the source code within the Docker image.

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

thanks, it's been resolved, Will the next release fix this if possible?
@dosu.

@justify-what commented on GitHub (Jan 16, 2025): > To modify the behavior of Dify's Docker deployment without directly altering the source code, you can use Docker's volume mounting feature to override specific files. Here's how you can do it: > > 1. **Create a Local Copy of the File**: First, create a local copy of the `executor.py` file that you want to modify. You can do this by copying the file from the running Docker container to your local machine. > 2. **Modify the Local Copy**: Make the necessary changes to your local copy of `executor.py`, such as replacing single quotes with double quotes in JSON strings. > 3. **Mount the Modified File**: Use Docker's volume mounting feature to replace the original file in the container with your modified version. You can do this by adding a volume mount to your `docker-compose.yaml` file: > services: > your_service_name: > volumes: > - ./path/to/your/local/executor.py:/path/in/container/executor.py > > > > > > > > > > Replace `your_service_name` with the name of the service running Dify, `./path/to/your/local/executor.py` with the path to your modified file, and `/path/in/container/executor.py` with the path to the original file in the container. > 4. **Restart the Docker Containers**: After updating the `docker-compose.yaml` file, restart your Docker containers to apply the changes: > docker compose down > docker compose up -d > > This approach allows you to customize the behavior of Dify without directly modifying the source code within the Docker image. > > _To continue talking to [Dosu](https://dosu.dev), mention [@dosu](https://github.com/dosu)._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/fb691ef8-4d61-4a66-9359-f9738e76ea87?feedback_type=other) thanks, it's been resolved, Will the next release fix this if possible? @dosu.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 16, 2025):

Could you provide more details about the specific issue you encountered and the changes you made? This information would help in determining whether the fix can be included in the next release.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 16, 2025): <!-- Answer --> Could you provide more details about the specific issue you encountered and the changes you made? This information would help in determining whether the fix can be included in the next release. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/acafa6e6-c3ba-46bc-a9d9-d246e761490e?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 20, 2025):

Image
@crazywoola commented on GitHub (Jan 20, 2025): <img width="343" alt="Image" src="https://github.com/user-attachments/assets/3b00e6b9-085a-4913-a289-87b9eb2ec25f" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7762