swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

JSONObject parameter

Open tpietsch opened this issue 12 years ago • 4 comments

Is there a way to get the json object without passing it though swaggers object mapper?

example....

POJO

class my{ public string myKey; public string myKey2; }

apiparam(my thisismyparam)

generates

{ "mykey" : "my value", "mykey2" : "my value" } then i add key values { "mykey" : "my value", "mykey2" : "my value", "key" : "value", "key" : "value", "key" : 0, "key" : [] } i want to be able to accept the added key values and parse them myself

tpietsch avatar Jun 13 '14 17:06 tpietsch

Okay, this has nothing to do with Swagger. If you want to parse fields that are not part of your POJO, you need to look into the JSON parser you use. If you use Jackson, for example, it has many tools to deal with that.

Keep in mind Swagger will not be able to describe such fields unless you explicitly specify them.

webron avatar Jun 13 '14 17:06 webron

i know swagger but if i place a JSONObject as one of my variables in my POJO i feel like that should be able to accommodate this requirement but when i use JSONObject or ArrayList

and i POST an arrayList of 3 json objects i get

[{},{},{}]

tpietsch avatar Jun 13 '14 17:06 tpietsch

I don't see how that is related to Swagger...

webron avatar Jun 13 '14 17:06 webron

maybe it isn't i guess

tpietsch avatar Jun 13 '14 17:06 tpietsch