2021-01-30

How to split a JSON object into an array

I've got a JSON object that looks like this

Key1      = Value1
Key2      = Value2

This pattern continues x times, always

  • KeyName
  • Unknown length of whitespace
  • = character
  • Value
  • New line

If I JSON.Stringify I get

Key1      = Value1\nKey2     = Value2\nKey3      = Value3\n

How can I get an array along the lines of

{"Key1":"Value1", "Key2":"Value2", "Key3":"Value3"}

I'm not even sure how to Google what I need. Any pointers greatly appreciated.



from Recent Questions - Stack Overflow https://ift.tt/2KZHv06
https://ift.tt/eA8V8J

No comments:

Post a Comment