objective of converters were to provide two basic features Eiffel2JSON and JSON2Eiffel). There will be a new design for converters as a standalone library on top of Current json library."
What status has that project?
Regards
Anders
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
from_json (a_json: detachable JSON_VALUE; ctx: JSON_DESERIALIZER_CONTEXT; a_type: detachable TYPE [detachable ANY]): detachable ANY
EL_SETTABLE_FROM_JSON_STRING*
EL_REFLECTED_FIELD*
{ name: "John", city: "New York" }
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users+unsubscribe@googlegroups.com.
Interesting. Could you write an example for converting this JSON
{ name: "John", city: "New York" }
to a class with two attributes name and city?
note
description: "Summary description for {TASK_DATA}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
TEST_DATA
inherit
JSON_DESERIALIZABLE
create
make_from_json
feature
firstname : STRING
lastname : STRING
convertible_features (a_object: ANY): ARRAY [STRING]
-- <Precursor>
once
Result := <<"firstname", "lastname">>
end
make_from_json (a_json: STRING)
-- <Precursor>
require else -- This must be here because the ancestor is False.
True -- Leaving it False, will cause this to fail.
local
l_object: detachable JSON_OBJECT -- You must have one of these because ...
l_any: detachable ANY
do
l_object := json_string_to_json_object (a_json) -- ... the `a_json' STRING is parsed to a JSON_OBJECT.
check attached_object: attached l_object end -- This proves that our JSON parsing was okay.
firstname := json_object_to_json_string_representation_attached ("firstname", l_object)
lastname := json_object_to_json_string_representation_attached ("lastname", l_object)
end
metadata_refreshed( a_current: ANY): ARRAY [JSON_METADATA]
do
Result := <<
>>
end
end
FYI: The "json_ext" library found here is one that I open sourced from Atlanta. It works fairly well. Not sure what the converters are about—will have to look that up.
On Wed, Sep 19, 2018 at 3:45 AM, anders <and...@bsharp.se> wrote:
HiThe https://github.com/eiffelhub/json implementations Readme file indicates that it might be implemented a JSON to Eiffel object converter in the future:"The converters part is now obsolete and not recommended (remember: theobjective of converters were to provide two basic features Eiffel2JSON and JSON2Eiffel). There will be a new design for converters as a standalone library on top of Current json library."What status has that project?RegardsAnders
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
Interesting. Could you write an example for converting this JSON
{ name: "John", city: "New York" }
to a class with two attributes name and city?
class PERSON
inherit EL_REFLECTIVELY_SETTABLE rename field_included as is_any_field, export_name as export_default, import_name as import_default end
EL_SETTABLE_FROM_JSON_STRING
create make_default, make_from_json
feature -- Access
gender: CHARACTER_32 -- symbol ♂ male OR ♀ female
name: ZSTRING
city: STRING_32
age: INTEGER
end
Recursive example video is found here.
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.