So the real task is to map a Postgres jsonb
type to something appropriate in Julia. For me it looks like to be String as the best match.
How about something like:
mutable struct XYZ
id::Int64
json::String
json_parsed::JSON3.Object
function XYZ( id::Int64, json::String )
new(id, json, JSON3.read(json) )
end
end
So, I suggest, that your XYZ struct and some other needed methods do the translation between the Postgres types json
and/or jsonb
. Does this makes sense to you? I am a bit brief in my explanation, I know, but I am not sure that I have hit the real problem you have. Perhaps someone else has solved this already.
If I am right, you may consider to change the headline, so it is clear, that it is about Postgres json/jsonb mapping to Julia.