Closed samlee64 closed 4 years ago
Yes a little while ago recursive key conversion needed to be added to this library, so that instances where someone is using sub queries those keys are also converted. This functionality can effectively be disabled by utilising the ignoreStringcase
option like so:
ignoreStringcase: (obj, name) => name !== 'root'
Personally I don't think this solution really addresses the problem. People are going to be in your situation much more often than other people who want or expect to have keys recursively converted. I have been feeling drawn to the idea of a new release that disables recursive conversion by default, and can be enabled with a separate option.
I decided to publish version 1.4.0 which solves your issue.
The ignoreStringcase
option has been removed and you don't have to worry about keys in your JSON objects being converted anymore. If you do want them converted then you will need to use the new recursiveStringcase
option to do so. The following should restore 1.3.0 functionality:
recursiveStringcase: () => true
Hope this helps, it makes me feel a little bit better about the library too. Thank you for your submission.
I have a jsonb column which I insert an object
{"foo_bar": "bar_foo"}
into.The representation in the postgres database is
{"foo_bar": "bar_foo"}
but when I pull the value out using knex and knex-stringcase, the object key gets converted to camelcase and I end up with{"fooBar": "bar_foo"}
.The value does not change, only the key.
Is this intended to be the expected behavior?
I am using