Skip to main content

Parse string into object

  • May 17, 2022
  • 3 replies
  • 14 views

Forum|alt.badge.img+14

Hi there - How is it possible to parse (convert string into object with keys) in airtable scripting?

Here is some sample string text:

{
  a: 'somestring',
  b: 42,
  c: false
},{
	a: 'somethine else',
    b: 10,
    c: true}

The output should be two objects with three keys

3 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • May 17, 2022

If your string were JSON, you could use JSON.parse(), but your string is not quite JSON. Can you get the string sent to you as JSON?


Forum|alt.badge.img+14
  • Author
  • Inspiring
  • 93 replies
  • May 17, 2022

If your string were JSON, you could use JSON.parse(), but your string is not quite JSON. Can you get the string sent to you as JSON?


Thanks. I am creating the string via Airtable scripting and reading it there as well.


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • May 18, 2022

Thanks. I am creating the string via Airtable scripting and reading it there as well.


Instead of (or in addition to) making the string in scripting, why not just make the object directly?