eiffelhub / json

Eiffel JSON library
Other
18 stars 13 forks source link

a common function to get a string value of descendants of JSON_VALUE #23

Open phgachoud opened 4 years ago

phgachoud commented 4 years ago

Was wondering some time ago what method could I use for all the JSON_VALUE as string. As as far as I remember the representation doesn't give the same in each type, etc...

Is there already a common way I ignore?

Why not redefine the out method?

Thx for your point of view

jocelyn commented 4 years ago

I guess we could add a JSON_VALUE.to_unicode_string: STRING_32 and maybe also JSON_VALUE.to_utf_8_string: STRING_8

With a precondition is_string so for real it would apply only to JSON_STRING

as it looks dangerous to allow this for any json value ... as user will end up using it often ... and may be fooled by a string value "null" for instance ... without knowing for sure it is a JSON_NULL or else .