-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I add a default value without a key? #295
Comments
@tidwall ^^ |
@ngarg-kr I played a bit with multipaths, literals and modifiers and I think I got basically the same behaviour you were looking for. Query:
Result:[["v","v"],[null,"v"],["v",null]] Explanation:The [[[{"k":null},{"k":"v"}],[{"k":null},{"k":"v"}]],[[{"k":null},{}],[{"k":null},{"k":"v"}]],[[{"k":null},{"k":"v"}],[{"k":null},{}]]] Then I apply the Caveats:I'm not totally sure all the steps are working as expected, I got there with some trial and error, and some modifier got applied to the inner layer a little bit automagically, hence I'm not sure that's the intended behaviour or possibly some bug that could potentially change behaviour in the future. Other alternativesOther possible alternatives that are simpler and would just need some additional parsing on your code are:
[[["v"],["v"]],[[],["v"]],[["v"],[]]]
[[{"k":"v"},{"k":"v"}],[{},{"k":"v"}],[{"k":"v"},{}]] I also noticed that also using the |
@tidwall @volans-
Sometimes the key vid\uid may not exist, the length(arr[i]) is not 4 |
If there is no way to return the default value, I can only append a string to complete the array length |
@litao09h could you provide the JSON input for your query please? |
We converted the log to json
After log conversion json
|
@litao09h Sorry but I don't understand. I was asking what is the JSON to which you apply the query |
A default value can be ensured by using the This uses a multipath array to put the To get the results @DMLfor is looking for in their original question.
|
is basically the same as what @volans- used in his example above
but it may be is a little easier to disect. |
That works for me ! Thank you for your patient answer |
Current results:
With default value:
Thanks:)
The text was updated successfully, but these errors were encountered: