0

I'm presented with an output from a system that the documentation identifies as "JSON" but follows a different syntax. Keys with colons in them are prefixed with a colon, key/value is separated by "=>" instead of ":" and only string values are put into quotes, so it looks like:

{
:"key:name"=>NumericOrDateValue, 
:"key:name"=>"StringValue", 
"keyname"=>NumericOrDateValue, 
"keyname"=>"StringValue" }

Anyone recognize this syntax? Is there a library to convert it to normal JSON?

andywolf
  • 1
  • 2
  • i found this post. It might help you https://stackoverflow.com/questions/18492784/difference-between-as-key-value-and-as-value-in-php-foreach – CosimoV Jul 02 '21 at 20:47
  • It could be Ruby: https://ruby-doc.org/core-2.1.0/Hash.html I've found a similar question here: https://stackoverflow.com/questions/3183786/how-to-convert-a-ruby-hash-object-to-json In what language do you need to consume this structure? – Henrik Clausen Jul 02 '21 at 21:42
  • It is an ETL project, just trying to de-serialize the data and write it to a database; converting this to JSON would be easiest; I was hoping to identify the format to be able to search for a simple way to convert it to JSON. – andywolf Jul 06 '21 at 12:41
  • It does look like Ruby except that the keys are in double quotes, not just prefixed by a colon. – andywolf Jul 06 '21 at 12:42

0 Answers0