Read and Write JSON from a Multiline Text Column

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

Viewing 2 reply threads
  • 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.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.