c# Newtonsoft.Json.JsonReaderException: ‘Error reading JArray from JsonReader. Path ‘‘, line 0

When the data queried by c# datatable is converted to JSON object, the following error is reported.

Newtonsoft.Json.JsonReaderException: 'Error reading JArray from JsonReader. Path '', line 0, position 0.

The reason for this problem is that the queried data set directly becomes a string, and then an error is reported when it is empty
solution: add judgment

		if (jsonStr.Length > 0)
                {
                    JArray jArray = JArray.Parse(jsonStr);
                    JProperty Data = new JProperty("Data", jArray);
                    ZzjDataObj.Add(Data);
                }
                else
                {
                    JArray jArray = new JArray();
                    JProperty Data = new JProperty("Data", jArray);
                    ZzjDataObj.Add(Data);
                }


Read More: