htmx.org 2.0.10, json-enc 2.0.3.
In my case this bug breaks some cases of the programmatic population of hx-vals. E.g. as in the example from the docs: hx-vals='js:{...foo()}' where foo() returns a map where some first-level value is [].
Steps
See https://jsfiddle.net/r4sgw3nh:
<script src="https://unpkg.com/htmx.org@2.0.10"></script>
<script src="https://unpkg.com/htmx-ext-json-enc@2.0.3/json-enc.js"></script>
<button type="button" hx-ext="json-enc" hx-post="/test" hx-vals='js:{
"firstLevel": [],
"secondLevel": {
"values": []
}
}'>
Click me
</button>
- Click
Click me.
- Inspect the made request payload in the browser devtools.
Actual
{"secondLevel":{"values":[]}}
Expected
{"firstLevel":[],"secondLevel":{"values":[]}}
htmx.org 2.0.10, json-enc 2.0.3.
In my case this bug breaks some cases of the programmatic population of
hx-vals. E.g. as in the example from the docs:hx-vals='js:{...foo()}'wherefoo()returns a map where some first-level value is[].Steps
See https://jsfiddle.net/r4sgw3nh:
Click me.Actual
{"secondLevel":{"values":[]}}Expected
{"firstLevel":[],"secondLevel":{"values":[]}}