When my model returns Json data I can return that to the user... but I need to convert to Zewo.JSON when I want to return an array of these JSON models to the user.
I think I understand the issue here. We need to support JsonRepresentable and [JsonRepresentable] as return options.
Can you paste a code snippet to reproduce this so I can make sure that's the issue?
I think @LoganWright and I were talking about how to make an array conform like this.
protocol Serializable {
func makeJson -> Json
}
This is fine as is. Because I can return anything. Double, String, int, Bool and Arrays/Dictionaries.
But if I want recursive dictionaries it doesn't work anymore since I need to use this function:
public init(_ value: [String: JsonRepresentable]).
But when I throw in the following data it doesn't work:
["hello": "world",
"number": 3,
"subDictionary": Json.object([
"subNumber": 4,
"substring": "bob"
]),
"bool": true
]
What I need to do is this:
["hello": "world",
"number": 3,
"subDictionary": Json.object([
"subNumber": 4,
"substring": "bob"
]).makeZewoJson(),
"bool": true
]
I just tested this on 0.8.1 and it's working fine
Json([
"hello": "world",
"number": 3,
"subDictionary": [
"subNumber": 4,
"subString": "bob"
],
"bool": true])
Thanks @timominous
Most helpful comment
I just tested this on 0.8.1 and it's working fine