Closed jiripudil closed 6 years ago
I would vote for "always as associative array", so json_decode(..., true)
. Otherway, one row may be decode as array, other as stdClass. IMHO type stability is better even object notation row->col->key->key
looks better.
Thanks @dg
Thank you for resolving the two issues I've reported. Our tests are now green with dibi/dibi@dev-master, I'll push it to staging later this week and let you know if there're any more problems. Thanks for your effort with 4.0.0, it looks very promising!
Thanks for testing :)
Is there any chance to disable that automatic json decoding?
$result->setType('column', Dibi\Type::TEXT);
Oh, thank you. Would you like a pull-request that would set this behaviour globally? (For example for big projects that are not able to react to this new feature quickly but would like to migration to more strict version of Dibi)
Yes. Probably the best way is to go via something like ->setFormat(Type::JSON, $this->config['result']['json'])
.... in Connection::createResultSet()
Description
The automatic decoding of JSON types forcibly creates a tree of objects. Unfortunately, we have code that accepts an array structure, so that instead of replacing this:
with this:
we are forced to have this:
which isn't much of an improvement.
Is it something we have to learn to live with, or would you consider making it somehow configurable? What do you think?
A quick research showed that e.g. doctrine/dbal's JsonType does the opposite and decodes into an array.