How should json look like to be valid for azure Data factory

Tony Johansson 40 Reputation points
2023-05-29T18:19:11.76+00:00

Hello,

I have a REST API that send these data when using Advanced Rest Client with method Get

[{"Date":"2022-04-20","GuestNight":"1144","BelaggningLogi":"34,5"},{"Date":"2022-04-21","GuestNight":"1267","BelaggningLogi":"41,0"},{"Date":"2022-04-22","GuestNight":"1193","BelaggningLogi":"39,2"},{"Date":"2022-04-23","GuestNight":"869","BelaggningLogi":"29,5"},{"Date":"2022-04-24","GuestNight":"168","BelaggningLogi":"8,7"},{"Date":"2022-04-25","GuestNight":"172","BelaggningLogi":"9,8"},{"Date":"2022-04-26","GuestNight":"168","BelaggningLogi":"9,7"}]

The REST API is done in .NET/C#

The endpoint look like this in C#

public ActionResult Reservations(string start, string end)
        {
            DbApi dbApi = new DbApi(Configuration);
            dbApi.GetGuestNights(start, end);
            IEnumerable<Booked> bookedList = dbApi.GetLodgingOccupancy(start, end);

            var json = JsonSerializer.Serialize(bookedList);

            return Ok(json);
        }

When I use Azure Data Factory and request the REST API I get the following response error back. When I get a valid resonse I will just send the output to a json file.

{
			"Code": 21155,
			"Message": "Failure happened on 'Source' side. ErrorCode=JsonInvalidDataFormat,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when deserializing source JSON file ''. Check if the data is in valid JSON object format.,Source=Microsoft.DataTransfer.ClientLibrary,'",
			"EventType": 0,
			"Category": 5,
			"Data": {
				"FailureInitiator": "Source"
			},
			"MsgId": null,
			"ExceptionType": null,
			"Source": null,
			"StackTrace": null,
			"InnerEventInfos": []
		}

I call the REST API like this 

The response I get back when I use Advanced Rest Client is a valid json so why can't azure Data factory understand the json it get back

Thank in advance

Tony Johansson
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,643 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,306 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,931 Reputation points
    2023-05-29T19:41:09.6833333+00:00

    Most likely the response is html, either an error page, or login page.


0 additional answers

Sort by: Most helpful