For example these json structures need to be converted to the following class:
JSON_str_1 = {"a":"stuff", "b":{"aa": "more_stuff", "bb":"even_more"}}
JSON_str_2 = {"a": "stuff", "aa": "more_stuff","b": {"bb":"even_more"}}
JSON_str_3 = {"b": {"a":"stuff" "aa": "more_stuff", "bb":"even_more"}}
To a class of this format:
class my_class < ActiveRecord
attr_accessor: :a, :aa, :bb
end
All of the information I need encoded is the same just the structure is different.
This would essentially involve flatttening the json structure.
How would one deal with that?
Where in the Rails app would one put that conversion functionality? The model? The controller? A PORO somewhere?
I have a lot of this kind of conversion from unoptimized JSON to my class specific formats and it seems like a pretty common issue.