0

I get a string which looks like this

["{action= some text, task= some text}", "{action= some text 2, task= some text 2 }" ]

how do I extract the content of action and task and store it in two seperate string? (E.g String action and String task)

unknown
  • 4,859
  • 10
  • 44
  • 62
user3325919
  • 45
  • 1
  • 7

1 Answers1

-1

If you are the Creator of this input String, I don't ever recommend this way of storing data. JSON is the best solution for you. No need to generate a complex REGEX that for sure will not be generic enough to accept your future edits

JSON is the enhanced way of storing files in a way of Parameter, Value data. You can simply create a JSON object and use its simple way of adding data data e.g. objectJSON.put("key", "value"). It is very similar to Object oriented, but with an external feature that is exporting your JSON object as a string file

Here is a good example of how to use JSON and parse them.

Sami Eltamawy
  • 9,874
  • 8
  • 48
  • 66