1 Replies - 225 Views - Last Post: 07 September 2019 - 08:33 AM Rate Topic: -----

#1 ahmedba   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 220
  • Joined: 24-January 14

How to display object name as start when serialize object using dynami

Posted 06 September 2019 - 09:33 PM

problem

How to display object name as start when serialize object using dynamic ?

object name not display as start of json why ?

generated json I need is

request_status : {

"status" : "failed",

"code": 1,

"message" : "login failed, incorrect username or password"

}

currently it display as 

{

"status" : "failed",

"code": 1,

"message" : "login failed, incorrect username or password"

}


code used for generate

dynamic request_status = new JObject();
                request_status.Status = "failed";
                request_status.Code = LoginStatus;
                request_status.Message = errorMessage;
               
                JsonResults = JsonConvert.SerializeObject(request_status);


Is This A Good Question/Topic? 0
  • +

Replies To: How to display object name as start when serialize object using dynami

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15433
  • View blog
  • Posts: 61,843
  • Joined: 12-June 08

Re: How to display object name as start when serialize object using dynami

Posted 07 September 2019 - 08:33 AM

Try adding 'request_status' to an anonymous object (you know.. the ones that start 'var'), and see about serializing that.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1