To me, toJSONString transform a bean a its json string representation, but the reciprocity is not true. That's a double edged question, I'm not sure we can guess the answer 100% right. Maybe we should see what/if the jsr says something about this...
On Apr 22, 2017 16:07, "Maxim Solodovnik" <[email protected]> wrote: Actually I thought toJSONString method is required to provide correct way of creating JSONObject from bean. In this case I see no reason why we should scan bean itself .... On Sat, Apr 22, 2017 at 9:04 PM, Sebastien <[email protected]> wrote: > Hi Maxim, > > Actually there was 2 questions, that's why it was not clear :) > > 1/ About how to handle the stack overflow. I saw here [1] that you handle > "instanceof JSONString" in the ctor. My question was about the accuracy of > this. Should it be handled in the ctor like this, or should it be handled > in the toString method. I prefer the second method because new > JSONObject(bean) should handle real bean properties, not the properties > that may have been set manually in toJSONString > > 2/ API break about renaming package or method signature changes is one > thing. Silent breaks are something else. If it is documented, that's fine. > But if it can be avoided and keep compatibility... that's better IMO :) > > Thanks :) > Sebastien. > > [1] > https://github.com/openjson/openjson/commit/d2367f28cebd8f21c4a4e22faec4ca > b2f8a95982#diff-d1df85e7c46815227f1dcb2b4b08ab33R204 > -- WBR Maxim aka solomax
