-
Notifications
You must be signed in to change notification settings - Fork 419
Closed
Description
Describe the bug
Here is my code
import { JsonForms } from "@jsonforms/react";
import { useState } from "react";
import {
materialRenderers,
materialCells,
} from "@jsonforms/material-renderers";
const Example = () => {
const [data] = useState({});
const schema = {
anyOf: [
{
type: "object",
properties: {
firstName: {
type: "object",
properties: {
A: {
type: "number",
maxLength: 1,
},
},
},
},
},
{
type: "string",
},
],
};
return (
<JsonForms
schema={schema}
uischema={undefined}
data={data}
onChange={(d: any) => {
console.log("getData ", d);
}}
renderers={materialRenderers}
cells={materialCells}
/>
);
};
I got this output:
I cant paste by code because it is a String object. When I copy this object it turns to:
{ "data": "1", "errors": [] }.
Obviously it is not a valid json object.
Expected behavior
I expected output:
{ "data": { "firstName": { "A": 1 } }, "errors": [] }
Steps to reproduce the issue
- Start this example and render:

- select anyof-1 tab & input any string

- select anyof-0 tab & input any string

- see error on console
Screenshots
No response
In which browser are you experiencing the issue?
Google Chrome 116.0.5845.96
Which Version of JSON Forms are you using?
v3.1.0
Framework
React
RendererSet
Material
Additional context
No response