windytan / redsea

Command-line FM-RDS decoder with JSON output.
MIT License
390 stars 36 forks source link

RT+ JSON names should not contain periods #49

Closed windytan closed 7 years ago

windytan commented 7 years ago

According to JSON API v1.0, member names must not contain periods. So the RadioText Plus fields should be exploded into objects:

"radiotext_plus":{
  "item.artist":"Silbermond",
  "item.title":"Das Leichteste der Welt",
  "item_running":true
}

should be

"radiotext_plus":{
  "item":{
    "artist":"Silbermond",
    "title":"Das Leichteste der Welt",
  },
  "item_running":true
}

or

"radiotext_plus":{
  "item":{
    "artist":"Silbermond",
    "title":"Das Leichteste der Welt",
    "running":true
  }
}

But this would pose a problem, because the content of RT+ class chat would be of ambiguous type (it may contain a string or an object with center string). So another way to do this would be:

"radiotext_plus":{
  "tags":[
    {
      "content-type":"item.artist",
      "data":"Silbermond"
    },
    {
      "content-type":"item.title",
      "data":"Das Leichteste der Welt"
    }
  ],
  "item_running":true
}

However, this would make the JSON more difficult to filter.