Display an array as an editable table

  • 1
  • Question
  • Updated 3 years ago
I have a text field that stores stores an array - formatted as either and HTTP POST or JSON array. Can I have this array displayed as a editable table?


HTTP POST:
items[0][Name]=Shirt&items[0][Quantity]=2&items[0][Price]=19.95&items[1][Name]=Jeans&items[0][Quantity]=3&items[0][Price]=89.99


JSON:
{"items": [
    {"Name":"Shirt", "Quantity":"2", "Price":"19.95"},
    {"Name":"Jeans", "Quantity":"3", "Price":"89.99"},
]}
Photo of Griffin Brown

Griffin Brown

  • 2,766 Points 2k badge 2x thumb
  • curious

Posted 3 years ago

  • 1
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Interesting question, Griffin.

Can you create a custom object that is just used for CRUD operations on the JSON Data?  You'll need to populate the model i.e deserialize from JSON to custom object and then determine best time to serialize back to JSON, store in the Text field and clean up the records in the custom object. Seems like a lot of ceremony, though.

Have you considered a custom renderer?  
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
You could do it with a custom table view.