Thema: Delphi Ist "true" valides JSON?

Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#13

AW: Ist "true" valides JSON?

  Alt 22. Jan 2021, 16:49
Bei TJSONObject ist mir ehrlich gesagt völlig egal, ob es als String oder Bool interpretiert wird. Ich caste das einfach nach Bedarf von TJSONValue nach TJSONString oder TJSONBool.
Du kannst aber nicht einfach casten wie du willst. Entweder steckt hinter dem Wert ein TJSONString oder es steckt dahinter ein TJSONBool. Du kannst kein TJSONValue das tatsächlich ein TJSONString ist nach TJSONBool casten ohne dass dir ggf. was um die Ohren fliegt!

Und zu der original Frage:

Ich hab ehrlich gesagt jetzt nicht in einer Spezifikation nachgeschaut aber meinem Verständnis nach ist

"True"

gültiges JSON. Es ist ein einzelner Json-String.

true

wäre auch gültig und wäre ein einzelner Json-Bool.
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat