Failed to process "L" of JSON value when calling Azure Functions from Azure Logic app.

Sohyeon Cho (DHL KR) 11 Reputation points
2023-07-28T05:47:45+00:00

The Logic app flow I'm creating has steps that call Azure Functions.

Azure Functions is responsible for sending SMS. Call this function from Logic app, SMS is sent well. This means that the request was sent successfully. However, in the Logic app flow, it fails with an error message of BadRequest.

<Logic app Error>

BadRequest. Http request failed: the content was not a valid JSON. Error while parsing JSON: 'Unexpected character encountered while parsing value: L. Path '', line 0, position 0.'

User's image

🔎Can't I use L as JSON Value??? I don't understand, am I not understanding the error correctly?

<Logic app History>

User's image

Content-Type = application/json; charset=utf-8

<Request Body>

{
  "callback": "01012341234",
  "dhlUnit": "HR",
  "dhlUserIp": "127.0.0.1",
  "dhlUserName": "Sohyeon Cho",
  "dstAddr": "01055556666",
  "msgType": "L",
  "subject": "HR Guide",
  "text": "LOGIC APP LMS TEST LOGIC APP LMS TEST LOGIC APP LMS TEST LOGIC APP LMS TEST LOGIC APP LMS TEST LOGIC APP LMS TEST"
}

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,679 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,996 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,611 Reputation points Microsoft Employee
    2023-08-03T16:12:04.3366667+00:00

    @Sohyeon Cho (DHL KR) Since the function app response is a string but has a Content-Type value set to application/json, it should ensure the string is enclosed in double quotes (") in the body.

    A string value enclosed in double quotes (") is still considered a valid JSON value and should be able to be parsed without error.

    Or you could set the Content-Type header value to text/plain in your function app response as well.