Анализ объекта JSON из строки, которая содержит больше, чем просто объект JSON.C#

Место общения программистов C#
Ответить
Гость
 Анализ объекта JSON из строки, которая содержит больше, чем просто объект JSON.

Сообщение Гость »


I receive a response from an API call and handle the response with three cases.
  • Failure
  • Failed because the actions were already performed
  • Success

I handle the case with "Failed due to previous completed actions" as a success.

The response with this case returns a string that I need to parse a JSON object from is as such

Failed ID is already closed {"ID":"0",system":"","user":"","secondaryID":"","date":"0001-01-01T00:00:00","currency":"USD"} What is the best way to retrieve the JSON object from the given API response? I have attempted to use the below line of code to parse the object from the given 'response' string. The number of the proceeding characters to the JSON object will be variable in length.

AlreadyCompleteModel jsonObj = JsonConvert.DeserializeObject(response); I appreciate a suggestion for a solution that will provide a string that can be parsed with the below line of code
JsonConvert.DeserializeObject(response);

Источник: https://stackoverflow.com/questions/780 ... son-object
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»