Okay here is the full version (and thanks for looking)
using JSON2
struct ClientSortBy
colName::String
revDir::Int32 # 0 asc 1 desc
ClientSortBy(colName::String, revDir::Int32) = new(colName,revDir)
ClientSortBy(d::Dict{String, Any}) = new(d["colName"], d["revDir"])
end
struct ClientFilter
colName::String
colAttr::String
ClientFilter(colName::String, colAttr::String) = new(colName,colAttr)
ClientFilter(d::Dict{String, Any}) = new(d["colName"], d["colAttr"])
end
mutable struct ClientnQ
name::String
scens::Vector{String}
joinScens::Vector{String}
filters::Vector{Vector{ClientFilter}}
groupBy::Vector{Vector{String}}
msrs::Vector{String}
joinMsrs::Vector{String}
sortBy::Vector{ClientSortBy}
ClientnQ(name,scens,joinScens,filters,groupBy,msrs,joinMsrs,sortBy) =
new(name,scens,joinScens,map(f->map(i->ClientFilter(i["colName"],i["colAttr"]),f),filters),groupBy,msrs,joinMsrs,map(s->ClientSortBy(s["colName"],s["revDir"]),sortBy))
end
q1 = """{
"name": "q1",
"scens": ["M00000001"],
"joinScens": [],
"filters": [[{"colName": "ENC_TYPE", "colAttr": "Inpatient"}]],
"groupBy":[["PAT_CLASS"],[]],
"msrs":["NET_REVENUE"],
"joinMsrs":[],
"sortBy":[{ "colName": "PAT_CLASS", "revDir":0}]
}"""
JSON2.read(q1,ClientnQ)
I get " ERROR: MethodError: no method matching getindex(::ClientFilter, ::String)"