Open laixintao opened 3 years ago
Hello, yes this issue is pretty annoying!!! If you give me some hints, I can check for the PR and the potential test coverage.
I think simply add a ?.toString
method will resolve this. Now a call ?.toString()
on every values before I feed a json into this component. :)
Yes, but it would be better if it was the library to do it without having me bother doing it in my code :)
annoying workaround:
let filteredData = Object.fromEntries(Object.entries(data));
Object.entries(filteredData).forEach(([key, value]) => {
if (typeof value == 'boolean') {
filteredData[key] = value.toString();
}
});
simple hack event your object is nested
const convertJSONBooleanToString = (json) => {
try {
const strData = JSON.stringify(json)
.replaceAll(":true", ':"true"')
.replaceAll(":false", ':"false"');
return JSON.parse(strData);
} catch (err) {
return json;
}
};
Hi, I think for
boolean
value, it is better if display string like"true"
/"false"
. Now just displays nothing.