0

An API is responding json in string quotes How can I parse this to Object

"{"ErrorMessage":null,"UserBo":{"GateCollection":{"GateBosList":[]},"Status":0,"DlEd":"\/Date(1541278800000)\/","DlSd":"\/Date(1520715600000)\/","DlValue":"01:00","IsDl":true,"MobileIMEINo":null,"BranchId":0,"BranchName":null,"BUtcOffSt":"(UTC-08:00) Pacific Time (US \u0026 Canada)","UtcOffSt":"-8:0","IsDaylightSaving":false,"UserId":2031898,"CompanyId":3,"FirstName":"Yerandy","ChartCode":null,"LastName":null,"Email":null,"UserName":"YERANDY","Password":"123","WorkPhone":null,"WorkPhoneExt":null,"HomePhone":null,"CellNumber":null,"Fax":null,"DateCreated":"\/Date(-62135596800000)\/","LastLogin":"\/Date(-62135596800000)\/","IsAuthanticated":false,"IsSelected":false,"MobileUserStatus":null,"UserBosCollection":{"UserBosList":[]},"UserRoleBosCollection":{"RoleBosList":[{"CompanyId":3,"RoleId":6837,"Name":"Customer","Description":"Customer","CreatedBy":null,"Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":6838,"Name":"Carrier","Description":"Carrier","CreatedBy":null,"Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027893,"Name":"Order Entry","Description":"Order entry module","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027898,"Name":"Dispatch \u0026 Order Entry","Description":"Dispatch \u0026 Order Entry","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027899,"Name":"Order entry, Dispatch \u0026 Billin","Description":"Order entry, Dispatch \u0026 Billin","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false}]},"Company":{"CompanyLogo":null,"ReportLogo":null,"CompanyId":null,"IsQbposting":null,"IsEnableSsl":0,"IsUseDefaultCredentials":0,"SmtpPort":null,"SmtpHost":null,"InvoiceRemarks":null,"Name":null,"IsSelected":false,"DisplayName":null,"Description":null,"Status":0,"Res1":null,"Res2":null,"Res3":null,"CompanyCode":null,"Postal_Address":null,"Street_Address":null,"City":null,"State":null,"Zip":null,"Phone":null,"Fax":null,"Email":null,"Greetings":null,"FiscalYear":null,"TaxNo":null,"MasterUserName":null,"MasterUserPassword":null,"BranchesList":{"Branches":[]}},"CarrierId":null,"CustomerId":{"CustomerPdfBoList":null,"CustomerDocumentsBosList":null,"CustomerDocumentBo":null,"CustomerPhoneExt":null,"CustomerTypeBo":null,"CustomerService":null,"CustomerServiceList":null,"CompanyId":null,"IsSelected":false,"CustomerId":6484,"CustomerCode":null,"CustomerName":"YC INTERNATIONAL GROUP INC","CustomerType":0,"TradingPartner":null,"SynchronizationtypeId":null,"Phone":null,"Fax":null,"IsAutoFax":null,"Email":null,"CustomerBranchId":0,"CSR":null,"StartOfBusiness":"\/Date(-62135596800000)\/","Description":null,"Status":0,"PaymentTermId":0,"Res1":null,"Res2":null,"Res3":null,"Res4":null,"Res5":null,"CustomerSalesRep":null,"CustomerAddresses":{"AddressBosList":[]},"CustomerAddress":null,"CustomerContacts":{"ContactList":[]},"CustomerContact":null,"User":null,"CustomerTypeName":null,"CustomerPaymentTermsBo":null,"Site":null,"CustomerServiceCollection":null},"DeviceId":null,"Log":null,"UserImage":"Default.png","DispatchSettings":null},"AlertCount":0,"CacheContext":null,"DtoStatus":1,"Message":null,"CompanyId":null,"BranchId":null,"BaseFilterList":null,"StartDate":"\/Date(-62135596800000)\/","EndDate":"\/Date(-62135596800000)\/","Day":null}"

1 Answer 1

1

JSON.parse should do the trick. Give this a try:

var stringResponse = '{"ErrorMessage":null,"UserBo":{"GateCollection":{"GateBosList":[]},"Status":0,"DlEd":"\/Date(1541278800000)\/","DlSd":"\/Date(1520715600000)\/","DlValue":"01:00","IsDl":true,"MobileIMEINo":null,"BranchId":0,"BranchName":null,"BUtcOffSt":"(UTC-08:00) Pacific Time (US \u0026 Canada)","UtcOffSt":"-8:0","IsDaylightSaving":false,"UserId":2031898,"CompanyId":3,"FirstName":"Yerandy","ChartCode":null,"LastName":null,"Email":null,"UserName":"YERANDY","Password":"123","WorkPhone":null,"WorkPhoneExt":null,"HomePhone":null,"CellNumber":null,"Fax":null,"DateCreated":"\/Date(-62135596800000)\/","LastLogin":"\/Date(-62135596800000)\/","IsAuthanticated":false,"IsSelected":false,"MobileUserStatus":null,"UserBosCollection":{"UserBosList":[]},"UserRoleBosCollection":{"RoleBosList":[{"CompanyId":3,"RoleId":6837,"Name":"Customer","Description":"Customer","CreatedBy":null,"Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":6838,"Name":"Carrier","Description":"Carrier","CreatedBy":null,"Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027893,"Name":"Order Entry","Description":"Order entry module","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027898,"Name":"Dispatch \u0026 Order Entry","Description":"Dispatch \u0026 Order Entry","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false},{"CompanyId":3,"RoleId":2027899,"Name":"Order entry, Dispatch \u0026 Billin","Description":"Order entry, Dispatch \u0026 Billin","CreatedBy":"JAY","Status":0,"ZonesList":{"ZoneBosList":[]},"UsersList":{"UserBosList":[]},"IsSelected":false}]},"Company":{"CompanyLogo":null,"ReportLogo":null,"CompanyId":null,"IsQbposting":null,"IsEnableSsl":0,"IsUseDefaultCredentials":0,"SmtpPort":null,"SmtpHost":null,"InvoiceRemarks":null,"Name":null,"IsSelected":false,"DisplayName":null,"Description":null,"Status":0,"Res1":null,"Res2":null,"Res3":null,"CompanyCode":null,"Postal_Address":null,"Street_Address":null,"City":null,"State":null,"Zip":null,"Phone":null,"Fax":null,"Email":null,"Greetings":null,"FiscalYear":null,"TaxNo":null,"MasterUserName":null,"MasterUserPassword":null,"BranchesList":{"Branches":[]}},"CarrierId":null,"CustomerId":{"CustomerPdfBoList":null,"CustomerDocumentsBosList":null,"CustomerDocumentBo":null,"CustomerPhoneExt":null,"CustomerTypeBo":null,"CustomerService":null,"CustomerServiceList":null,"CompanyId":null,"IsSelected":false,"CustomerId":6484,"CustomerCode":null,"CustomerName":"YC INTERNATIONAL GROUP INC","CustomerType":0,"TradingPartner":null,"SynchronizationtypeId":null,"Phone":null,"Fax":null,"IsAutoFax":null,"Email":null,"CustomerBranchId":0,"CSR":null,"StartOfBusiness":"\/Date(-62135596800000)\/","Description":null,"Status":0,"PaymentTermId":0,"Res1":null,"Res2":null,"Res3":null,"Res4":null,"Res5":null,"CustomerSalesRep":null,"CustomerAddresses":{"AddressBosList":[]},"CustomerAddress":null,"CustomerContacts":{"ContactList":[]},"CustomerContact":null,"User":null,"CustomerTypeName":null,"CustomerPaymentTermsBo":null,"Site":null,"CustomerServiceCollection":null},"DeviceId":null,"Log":null,"UserImage":"Default.png","DispatchSettings":null},"AlertCount":0,"CacheContext":null,"DtoStatus":1,"Message":null,"CompanyId":null,"BranchId":null,"BaseFilterList":null,"StartDate":"\/Date(-62135596800000)\/","EndDate":"\/Date(-62135596800000)\/","Day":null}';

console.log(JSON.parse(stringResponse));

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.