Read and Write JSON from a Multiline Text Column

Forums SPJS-Utility Read and Write JSON from a Multiline Text Column

This topic contains 2 replies, has 2 voices, and was last updated by  DCH 5 months ago.

  • Author
    Posts
  • #15129

    DCH
    Participant

    Alexander,

    I want to store JSON data in a multiline text column and read and write to it. It looks like that is how you handle the config lists for DFFS, Charts, etc. Do you already have functions written to handle that in the SPJS-Utility file? Would they be something I could take advantage of, or are they specific to your solutions?

    Thanks!

  • #15134

    Alexander Bautz
    Keymaster

    Nothing special – I use this for reading:

    var rawValue = getFieldValue("NameOfField");
    var dataObject = $.parseJSON(rawValue);

    And this to write it back as JSON:

    var jString = JSON.stringify(dataObject);
    setFieldValue("NameOfField",jString);

    Alexander

  • #15138

    DCH
    Participant

    Ha, so easy. Thanks again.

You must be logged in to reply to this topic.