JSON DeSerialization Help?Write a generic JSON-serializable Parameters class without hitting “Apex Type unsupported in JSON: Object”APEX ENUM Serialize to and Deserialize from JSONJSON and escaped double quotedeserializing JSON returns a null objectJSON deserialize into wrapper class errorsJSON String test classJSON: Cannot deserialize instance of date from VALUE_STRINGSystem.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set while deseriliasing json PayloadSalesforce REST JSON not getting serialized properly?How to deserialize my json result?

Rusty Chain and back cassette – Replace or Repair?

When do you stop "pushing" a book?

Are wands in any sort of book going to be too much like Harry Potter?

Names of the Six Tastes

How can I test a shell script in a "safe environment" to avoid harm to my computer?

A Latin text with dependency tree

What is the radius of the circle in this problem?

Which spells are in some way related to shadows or the Shadowfell?

JSON DeSerialization Help?

Thawing Glaciers return to hand interaction

Is there a need for better software for writers?

Do Monks gain the 9th level Unarmored Movement benefit when wearing armor or using a shield?

Do Rabbis admit emotional involvement in their rulings?

Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?

And now you see it II (the B side)

resoldering copper waste pipe

Using SUBSTRING and RTRIM Together

Lorentz invariance of Maxwell's equations in matter

Company stopped paying my salary. What are my options?

What does the "DS" in "DS-..." US visa application forms stand for?

Does Thread.yield() do anything if we have enough processors to service all threads?

How long can fsck take on a 30 TB volume?

Narcissistic cube asks who are we?

Pre-1993 comic in which Wolverine's claws were turned to rubber?



JSON DeSerialization Help?


Write a generic JSON-serializable Parameters class without hitting “Apex Type unsupported in JSON: Object”APEX ENUM Serialize to and Deserialize from JSONJSON and escaped double quotedeserializing JSON returns a null objectJSON deserialize into wrapper class errorsJSON String test classJSON: Cannot deserialize instance of date from VALUE_STRINGSystem.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set while deseriliasing json PayloadSalesforce REST JSON not getting serialized properly?How to deserialize my json result?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am currently working on an integration with other systems and I have the JSON coming back in the below format.




"searchDocumentsResponse":
"documentsIndexInfo": [

"contentElementsInfo":
"fileName": "test.pdf",
"fileSize": 1010694,
"indexNumber": 0,
"mimeType": "application/pdf"
,
"guid": "123456789-1234-1234-1234-92393300000",
"majorVersion": 1,
"minorVersion": 0,
"objectStore": "09876543212-1234-4B53-8CC5-469444E92456",
"pathName": "",
"properties": [

"multiValue": false,
"name": "Document_Type",
"type": "STRING",
"value": "TEST"
,

"multiValue": false,
"name": "ScanTMSTMP",
"type": "DATE",
"value": "5/16/1920"
,

"multiValue": false,
"name": "f_DocNumber",
"type": "STRING",
"value": ""
,

"multiValue": false,
"name": "MimeType",
"type": "STRING",
"value": "application/pdf"
,

"multiValue": false,
"name": "DateCreated",
"type": "DATE",
"value": "5/31/2018"

]


],
"numDocObjectsFound": 1,
"numDocObjectsReturned": 1,
"responseStatus":
"code": "OK",
"message": ""
,
"startingDocObject": 0




And I am trying to parse the response like below:



public class DocumentRetrievalResponse 

public SearchDocumentsResponse searchDocumentsResponse get;set;
public cecDocumentRetrievalResponse()


public class SearchDocumentsResponse
public String numDocObjectsFound get;set;
public String numDocObjectsReturned get;set;
public ResponseStatus responseStatus get;set;
public String startingDocObject get;set;
public List<DocumentsIndexInfo> documentsIndexInfo get;set; documentsIndexInfo = new List<DocumentsIndexInfo>();
public SearchDocumentsResponse()



public class ResponseStatus
public String code get;set;
public String messageget;set;
public ResponseStatus()




public class DocumentsIndexInfo
public String guidget;set; guid = null;
public Integer majorVersionget;set; majorVersion = 0;
public Integer minorVersionget;set;minorVersion = 0;
public String objectStoreget;set;objectStore = null;
public String pathNameget;set; pathName = null;
public ContentElementsInfo contentElementsInfo get;set;
public List<Properties> propertiesget;set; properties = new List<Properties>();



public class ContentElementsInfo
public String fileNameget;set; fileName = null;
public Integer fileSizeget;set; fileSize = 0;
public Integer indexNumberget;set; indexNumber = 0;
public String mimeTypeget;set;mimeType = null;



public class Properties
public String name get;set;
public String value get;set;
public String type get;set;
public String multiValue get;set; multiValue = 'false';





And to deserialize, I have the below lines:



System.Type resultType = System.Type.forName('DocumentRetrievalResponse');
DocumentRetrievalResponse deserializeResults =
(DocumentRetrievalResponse)JSON.deserialize(result, resultType);


When I run it, I get the JSON Exception as below. I might be overthinking and missing something here. Any help on this is appreciated.




FATAL_ERROR System.JSONException: Expected DocumentRetrievalResponse.ContentElementsInfo but found [line:1, column:2444]




PS: if I comment the declaration public ContentElementsInfo contentElementsInfo get;set;, the deserialize happens fine but without ContentElementsInfo.










share|improve this question



















  • 1





    Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

    – Jayant Das
    5 hours ago











  • Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

    – Adrian Larson
    5 hours ago












  • N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

    – cropredy
    5 hours ago

















1















I am currently working on an integration with other systems and I have the JSON coming back in the below format.




"searchDocumentsResponse":
"documentsIndexInfo": [

"contentElementsInfo":
"fileName": "test.pdf",
"fileSize": 1010694,
"indexNumber": 0,
"mimeType": "application/pdf"
,
"guid": "123456789-1234-1234-1234-92393300000",
"majorVersion": 1,
"minorVersion": 0,
"objectStore": "09876543212-1234-4B53-8CC5-469444E92456",
"pathName": "",
"properties": [

"multiValue": false,
"name": "Document_Type",
"type": "STRING",
"value": "TEST"
,

"multiValue": false,
"name": "ScanTMSTMP",
"type": "DATE",
"value": "5/16/1920"
,

"multiValue": false,
"name": "f_DocNumber",
"type": "STRING",
"value": ""
,

"multiValue": false,
"name": "MimeType",
"type": "STRING",
"value": "application/pdf"
,

"multiValue": false,
"name": "DateCreated",
"type": "DATE",
"value": "5/31/2018"

]


],
"numDocObjectsFound": 1,
"numDocObjectsReturned": 1,
"responseStatus":
"code": "OK",
"message": ""
,
"startingDocObject": 0




And I am trying to parse the response like below:



public class DocumentRetrievalResponse 

public SearchDocumentsResponse searchDocumentsResponse get;set;
public cecDocumentRetrievalResponse()


public class SearchDocumentsResponse
public String numDocObjectsFound get;set;
public String numDocObjectsReturned get;set;
public ResponseStatus responseStatus get;set;
public String startingDocObject get;set;
public List<DocumentsIndexInfo> documentsIndexInfo get;set; documentsIndexInfo = new List<DocumentsIndexInfo>();
public SearchDocumentsResponse()



public class ResponseStatus
public String code get;set;
public String messageget;set;
public ResponseStatus()




public class DocumentsIndexInfo
public String guidget;set; guid = null;
public Integer majorVersionget;set; majorVersion = 0;
public Integer minorVersionget;set;minorVersion = 0;
public String objectStoreget;set;objectStore = null;
public String pathNameget;set; pathName = null;
public ContentElementsInfo contentElementsInfo get;set;
public List<Properties> propertiesget;set; properties = new List<Properties>();



public class ContentElementsInfo
public String fileNameget;set; fileName = null;
public Integer fileSizeget;set; fileSize = 0;
public Integer indexNumberget;set; indexNumber = 0;
public String mimeTypeget;set;mimeType = null;



public class Properties
public String name get;set;
public String value get;set;
public String type get;set;
public String multiValue get;set; multiValue = 'false';





And to deserialize, I have the below lines:



System.Type resultType = System.Type.forName('DocumentRetrievalResponse');
DocumentRetrievalResponse deserializeResults =
(DocumentRetrievalResponse)JSON.deserialize(result, resultType);


When I run it, I get the JSON Exception as below. I might be overthinking and missing something here. Any help on this is appreciated.




FATAL_ERROR System.JSONException: Expected DocumentRetrievalResponse.ContentElementsInfo but found [line:1, column:2444]




PS: if I comment the declaration public ContentElementsInfo contentElementsInfo get;set;, the deserialize happens fine but without ContentElementsInfo.










share|improve this question



















  • 1





    Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

    – Jayant Das
    5 hours ago











  • Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

    – Adrian Larson
    5 hours ago












  • N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

    – cropredy
    5 hours ago













1












1








1








I am currently working on an integration with other systems and I have the JSON coming back in the below format.




"searchDocumentsResponse":
"documentsIndexInfo": [

"contentElementsInfo":
"fileName": "test.pdf",
"fileSize": 1010694,
"indexNumber": 0,
"mimeType": "application/pdf"
,
"guid": "123456789-1234-1234-1234-92393300000",
"majorVersion": 1,
"minorVersion": 0,
"objectStore": "09876543212-1234-4B53-8CC5-469444E92456",
"pathName": "",
"properties": [

"multiValue": false,
"name": "Document_Type",
"type": "STRING",
"value": "TEST"
,

"multiValue": false,
"name": "ScanTMSTMP",
"type": "DATE",
"value": "5/16/1920"
,

"multiValue": false,
"name": "f_DocNumber",
"type": "STRING",
"value": ""
,

"multiValue": false,
"name": "MimeType",
"type": "STRING",
"value": "application/pdf"
,

"multiValue": false,
"name": "DateCreated",
"type": "DATE",
"value": "5/31/2018"

]


],
"numDocObjectsFound": 1,
"numDocObjectsReturned": 1,
"responseStatus":
"code": "OK",
"message": ""
,
"startingDocObject": 0




And I am trying to parse the response like below:



public class DocumentRetrievalResponse 

public SearchDocumentsResponse searchDocumentsResponse get;set;
public cecDocumentRetrievalResponse()


public class SearchDocumentsResponse
public String numDocObjectsFound get;set;
public String numDocObjectsReturned get;set;
public ResponseStatus responseStatus get;set;
public String startingDocObject get;set;
public List<DocumentsIndexInfo> documentsIndexInfo get;set; documentsIndexInfo = new List<DocumentsIndexInfo>();
public SearchDocumentsResponse()



public class ResponseStatus
public String code get;set;
public String messageget;set;
public ResponseStatus()




public class DocumentsIndexInfo
public String guidget;set; guid = null;
public Integer majorVersionget;set; majorVersion = 0;
public Integer minorVersionget;set;minorVersion = 0;
public String objectStoreget;set;objectStore = null;
public String pathNameget;set; pathName = null;
public ContentElementsInfo contentElementsInfo get;set;
public List<Properties> propertiesget;set; properties = new List<Properties>();



public class ContentElementsInfo
public String fileNameget;set; fileName = null;
public Integer fileSizeget;set; fileSize = 0;
public Integer indexNumberget;set; indexNumber = 0;
public String mimeTypeget;set;mimeType = null;



public class Properties
public String name get;set;
public String value get;set;
public String type get;set;
public String multiValue get;set; multiValue = 'false';





And to deserialize, I have the below lines:



System.Type resultType = System.Type.forName('DocumentRetrievalResponse');
DocumentRetrievalResponse deserializeResults =
(DocumentRetrievalResponse)JSON.deserialize(result, resultType);


When I run it, I get the JSON Exception as below. I might be overthinking and missing something here. Any help on this is appreciated.




FATAL_ERROR System.JSONException: Expected DocumentRetrievalResponse.ContentElementsInfo but found [line:1, column:2444]




PS: if I comment the declaration public ContentElementsInfo contentElementsInfo get;set;, the deserialize happens fine but without ContentElementsInfo.










share|improve this question
















I am currently working on an integration with other systems and I have the JSON coming back in the below format.




"searchDocumentsResponse":
"documentsIndexInfo": [

"contentElementsInfo":
"fileName": "test.pdf",
"fileSize": 1010694,
"indexNumber": 0,
"mimeType": "application/pdf"
,
"guid": "123456789-1234-1234-1234-92393300000",
"majorVersion": 1,
"minorVersion": 0,
"objectStore": "09876543212-1234-4B53-8CC5-469444E92456",
"pathName": "",
"properties": [

"multiValue": false,
"name": "Document_Type",
"type": "STRING",
"value": "TEST"
,

"multiValue": false,
"name": "ScanTMSTMP",
"type": "DATE",
"value": "5/16/1920"
,

"multiValue": false,
"name": "f_DocNumber",
"type": "STRING",
"value": ""
,

"multiValue": false,
"name": "MimeType",
"type": "STRING",
"value": "application/pdf"
,

"multiValue": false,
"name": "DateCreated",
"type": "DATE",
"value": "5/31/2018"

]


],
"numDocObjectsFound": 1,
"numDocObjectsReturned": 1,
"responseStatus":
"code": "OK",
"message": ""
,
"startingDocObject": 0




And I am trying to parse the response like below:



public class DocumentRetrievalResponse 

public SearchDocumentsResponse searchDocumentsResponse get;set;
public cecDocumentRetrievalResponse()


public class SearchDocumentsResponse
public String numDocObjectsFound get;set;
public String numDocObjectsReturned get;set;
public ResponseStatus responseStatus get;set;
public String startingDocObject get;set;
public List<DocumentsIndexInfo> documentsIndexInfo get;set; documentsIndexInfo = new List<DocumentsIndexInfo>();
public SearchDocumentsResponse()



public class ResponseStatus
public String code get;set;
public String messageget;set;
public ResponseStatus()




public class DocumentsIndexInfo
public String guidget;set; guid = null;
public Integer majorVersionget;set; majorVersion = 0;
public Integer minorVersionget;set;minorVersion = 0;
public String objectStoreget;set;objectStore = null;
public String pathNameget;set; pathName = null;
public ContentElementsInfo contentElementsInfo get;set;
public List<Properties> propertiesget;set; properties = new List<Properties>();



public class ContentElementsInfo
public String fileNameget;set; fileName = null;
public Integer fileSizeget;set; fileSize = 0;
public Integer indexNumberget;set; indexNumber = 0;
public String mimeTypeget;set;mimeType = null;



public class Properties
public String name get;set;
public String value get;set;
public String type get;set;
public String multiValue get;set; multiValue = 'false';





And to deserialize, I have the below lines:



System.Type resultType = System.Type.forName('DocumentRetrievalResponse');
DocumentRetrievalResponse deserializeResults =
(DocumentRetrievalResponse)JSON.deserialize(result, resultType);


When I run it, I get the JSON Exception as below. I might be overthinking and missing something here. Any help on this is appreciated.




FATAL_ERROR System.JSONException: Expected DocumentRetrievalResponse.ContentElementsInfo but found [line:1, column:2444]




PS: if I comment the declaration public ContentElementsInfo contentElementsInfo get;set;, the deserialize happens fine but without ContentElementsInfo.







apex json deserialize parser






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 5 hours ago









Adrian Larson

112k19123262




112k19123262










asked 6 hours ago









RajeshRajesh

3116




3116







  • 1





    Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

    – Jayant Das
    5 hours ago











  • Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

    – Adrian Larson
    5 hours ago












  • N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

    – cropredy
    5 hours ago












  • 1





    Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

    – Jayant Das
    5 hours ago











  • Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

    – Adrian Larson
    5 hours ago












  • N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

    – cropredy
    5 hours ago







1




1





Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

– Jayant Das
5 hours ago





Unless its a typo, you have an invalid constructor here public cecDocumentRetrievalResponse(). Is this the only error you are getting? With a minimal code, if reproduced, I don't see an issue here.

– Jayant Das
5 hours ago













Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

– Adrian Larson
5 hours ago






Your model syntax is awkward, as you have multiple instance initializers (e.g. documentsIndexInfo = new List<DocumentsIndexInfo>();) in several of your class definitions. They do nothing in the context of deserialization and can simply be removed. In addition, the documentation recommends you reserve use of initializers for complex logic.

– Adrian Larson
5 hours ago














N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

– cropredy
5 hours ago





N.B. attribute multiValue sb declared as Boolean; majorVersion and minorVersion as Integer

– cropredy
5 hours ago










1 Answer
1






active

oldest

votes


















4














You seem to have a typo in your class.



cecDocumentRetrievalResponse()


should be
DocumentRetrievalResponse()



If I use your same DocumentRetrievalResponse class, remove the cec and use your JSON I can run your lines and it works for me. I made no changes to your code.



String result = '"searchDocumentsResponse": "documentsIndexInfo": ["contentElementsInfo": "fileName": "test.pdf","fileSize": 1010694,"indexNumber": 0,"mimeType": "application/pdf","guid": "123456789-1234-1234-1234-92393300000","majorVersion": 1,"minorVersion": 0,"objectStore": "09876543212-1234-4B53-8CC5-469444E92456","pathName": "","properties": ["multiValue": false,"name": "Document_Type","type": "STRING","value": "TEST","multiValue": false,"name": "ScanTMSTMP","type": "DATE","value": "5/16/1920","multiValue": false,"name": "f_DocNumber","type": "STRING","value": "","multiValue": false,"name": "MimeType","type": "STRING","value": "application/pdf","multiValue": false,"name": "DateCreated","type": "DATE","value": "5/31/2018"] ],"numDocObjectsFound": 1,"numDocObjectsReturned": 1,"responseStatus": "code": "OK","message": "","startingDocObject": 0';
System.Type resultType = System.Type.forName('DocumentRetrievalResponse');

DocumentRetrievalResponse deserializeResults = (DocumentRetrievalResponse)JSON.deserialize(result, resultType);
System.debug('deserializeResults ' + deserializeResults.searchDocumentsResponse.documentsIndexInfo[0].contentElementsInfo.fileName);





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "459"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f261700%2fjson-deserialization-help%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    You seem to have a typo in your class.



    cecDocumentRetrievalResponse()


    should be
    DocumentRetrievalResponse()



    If I use your same DocumentRetrievalResponse class, remove the cec and use your JSON I can run your lines and it works for me. I made no changes to your code.



    String result = '"searchDocumentsResponse": "documentsIndexInfo": ["contentElementsInfo": "fileName": "test.pdf","fileSize": 1010694,"indexNumber": 0,"mimeType": "application/pdf","guid": "123456789-1234-1234-1234-92393300000","majorVersion": 1,"minorVersion": 0,"objectStore": "09876543212-1234-4B53-8CC5-469444E92456","pathName": "","properties": ["multiValue": false,"name": "Document_Type","type": "STRING","value": "TEST","multiValue": false,"name": "ScanTMSTMP","type": "DATE","value": "5/16/1920","multiValue": false,"name": "f_DocNumber","type": "STRING","value": "","multiValue": false,"name": "MimeType","type": "STRING","value": "application/pdf","multiValue": false,"name": "DateCreated","type": "DATE","value": "5/31/2018"] ],"numDocObjectsFound": 1,"numDocObjectsReturned": 1,"responseStatus": "code": "OK","message": "","startingDocObject": 0';
    System.Type resultType = System.Type.forName('DocumentRetrievalResponse');

    DocumentRetrievalResponse deserializeResults = (DocumentRetrievalResponse)JSON.deserialize(result, resultType);
    System.debug('deserializeResults ' + deserializeResults.searchDocumentsResponse.documentsIndexInfo[0].contentElementsInfo.fileName);





    share|improve this answer



























      4














      You seem to have a typo in your class.



      cecDocumentRetrievalResponse()


      should be
      DocumentRetrievalResponse()



      If I use your same DocumentRetrievalResponse class, remove the cec and use your JSON I can run your lines and it works for me. I made no changes to your code.



      String result = '"searchDocumentsResponse": "documentsIndexInfo": ["contentElementsInfo": "fileName": "test.pdf","fileSize": 1010694,"indexNumber": 0,"mimeType": "application/pdf","guid": "123456789-1234-1234-1234-92393300000","majorVersion": 1,"minorVersion": 0,"objectStore": "09876543212-1234-4B53-8CC5-469444E92456","pathName": "","properties": ["multiValue": false,"name": "Document_Type","type": "STRING","value": "TEST","multiValue": false,"name": "ScanTMSTMP","type": "DATE","value": "5/16/1920","multiValue": false,"name": "f_DocNumber","type": "STRING","value": "","multiValue": false,"name": "MimeType","type": "STRING","value": "application/pdf","multiValue": false,"name": "DateCreated","type": "DATE","value": "5/31/2018"] ],"numDocObjectsFound": 1,"numDocObjectsReturned": 1,"responseStatus": "code": "OK","message": "","startingDocObject": 0';
      System.Type resultType = System.Type.forName('DocumentRetrievalResponse');

      DocumentRetrievalResponse deserializeResults = (DocumentRetrievalResponse)JSON.deserialize(result, resultType);
      System.debug('deserializeResults ' + deserializeResults.searchDocumentsResponse.documentsIndexInfo[0].contentElementsInfo.fileName);





      share|improve this answer

























        4












        4








        4







        You seem to have a typo in your class.



        cecDocumentRetrievalResponse()


        should be
        DocumentRetrievalResponse()



        If I use your same DocumentRetrievalResponse class, remove the cec and use your JSON I can run your lines and it works for me. I made no changes to your code.



        String result = '"searchDocumentsResponse": "documentsIndexInfo": ["contentElementsInfo": "fileName": "test.pdf","fileSize": 1010694,"indexNumber": 0,"mimeType": "application/pdf","guid": "123456789-1234-1234-1234-92393300000","majorVersion": 1,"minorVersion": 0,"objectStore": "09876543212-1234-4B53-8CC5-469444E92456","pathName": "","properties": ["multiValue": false,"name": "Document_Type","type": "STRING","value": "TEST","multiValue": false,"name": "ScanTMSTMP","type": "DATE","value": "5/16/1920","multiValue": false,"name": "f_DocNumber","type": "STRING","value": "","multiValue": false,"name": "MimeType","type": "STRING","value": "application/pdf","multiValue": false,"name": "DateCreated","type": "DATE","value": "5/31/2018"] ],"numDocObjectsFound": 1,"numDocObjectsReturned": 1,"responseStatus": "code": "OK","message": "","startingDocObject": 0';
        System.Type resultType = System.Type.forName('DocumentRetrievalResponse');

        DocumentRetrievalResponse deserializeResults = (DocumentRetrievalResponse)JSON.deserialize(result, resultType);
        System.debug('deserializeResults ' + deserializeResults.searchDocumentsResponse.documentsIndexInfo[0].contentElementsInfo.fileName);





        share|improve this answer













        You seem to have a typo in your class.



        cecDocumentRetrievalResponse()


        should be
        DocumentRetrievalResponse()



        If I use your same DocumentRetrievalResponse class, remove the cec and use your JSON I can run your lines and it works for me. I made no changes to your code.



        String result = '"searchDocumentsResponse": "documentsIndexInfo": ["contentElementsInfo": "fileName": "test.pdf","fileSize": 1010694,"indexNumber": 0,"mimeType": "application/pdf","guid": "123456789-1234-1234-1234-92393300000","majorVersion": 1,"minorVersion": 0,"objectStore": "09876543212-1234-4B53-8CC5-469444E92456","pathName": "","properties": ["multiValue": false,"name": "Document_Type","type": "STRING","value": "TEST","multiValue": false,"name": "ScanTMSTMP","type": "DATE","value": "5/16/1920","multiValue": false,"name": "f_DocNumber","type": "STRING","value": "","multiValue": false,"name": "MimeType","type": "STRING","value": "application/pdf","multiValue": false,"name": "DateCreated","type": "DATE","value": "5/31/2018"] ],"numDocObjectsFound": 1,"numDocObjectsReturned": 1,"responseStatus": "code": "OK","message": "","startingDocObject": 0';
        System.Type resultType = System.Type.forName('DocumentRetrievalResponse');

        DocumentRetrievalResponse deserializeResults = (DocumentRetrievalResponse)JSON.deserialize(result, resultType);
        System.debug('deserializeResults ' + deserializeResults.searchDocumentsResponse.documentsIndexInfo[0].contentElementsInfo.fileName);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 5 hours ago









        TadTad

        1359




        1359



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Salesforce Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f261700%2fjson-deserialization-help%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367