Read JSON

Kelly Burgess kellyb at montana.com
Mon Sep 16 10:20:14 UTC 2024


Hi Xavier,

>I have a JSON field TX_CONFIG with a pair data {“color”:”kRed”}
> ...
>Is there a way to read the value of a JSON directly without the need of an intermediate row?

This will only work for your simple single-element JSON example, and it's fragile... and note that I've used ascii 34 double-quotes, while your example is using styled double-quotes.

  Calculate json as '{"font":"Times New Roman"}'
  Calculate tag as '"font":"'     ## includes colon and opening quote of value
  Calculate value as mid(json,pos(tag,json)+len(tag),len(json)-(len(json)-rpos('"',json))-(pos(tag,json)+len(tag)))
  Breakpoint 

Kelly


More information about the omnisdev-en mailing list