bigskysoftware / bigskysoftware/htmx-extensions
json-enc extension converts boolean values to strings when sending JSON to serve
- Dominant language
- JavaScript
- Stars
- 284
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
The `htmx-ext-json-enc` extension (version 2.0.0) is converting JavaScript boolean values to strings when serializing data to JSON, which causes type errors when the server expects actual boolean values.
## Expected Behavior
When using the json-enc extension with boolean values:
```html
Submit
```
The JSON sent to the server should contain actual boolean values:
```json
{
"isForced": true
}
```
## Actual Behavior
The extension is sending string representations of boolean values:
```json
{
"isForced": "true"
}
```
This causes type errors on the server side when using strongly-typed languages like Go:
Contributor guide
Research direction
Start by reproducing the provided htmx-ext-json-enc example with hx-vars containing a boolean, then trace the extension's JSON serialization path. Done means the request payload contains a JSON boolean rather than the string "true", including when sent to a strongly typed server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100