I’m trying to create a form task by using JSON file but getting below error:
Create Task: ‘Newtonsoft.Json.Linq.JArray’ does not contain a definition for ‘id’
Can anyone help
Hi @amits159
Welcome to the community
Please Try this json
{
“id”: “ApproveForm”,
“name”: “Approval Task”,
“priority”: “High”
}
Hope this will help you and let me know if you still face the issue
Happy to help!!
it’s not working. If i try to open the json in " Open Form Deaigner" the form is loading but when i run the automation it’s giving error
Try this
The issue occurs because Create Task expects a JObject with mandatory fields (id, type, components).
Open Form Designer may still load the form because it only validates UI structure.
At runtime, the process fails when the JSON is deserialized as a JArray or when required fields are missing.Deserializing the JSON as Newtonsoft.Json.Linq.JObject and passing it directly to Create Task resolves the issue.
If it’s not work please elaborate the issue and help me with the screenshot of the error
Hi @amits159 ,
Try this ![]()
This error occurs when the JSON root is a JArray and you try to read id directly from it. You must either change the JSON to an object or first select an item from the array (for example jArray(0)(“id”)).
Try this
-
Export the form JSON from UiPath Apps / Form Designer as a task-compatible JSON, or
-
Use Create Task → Form field and point it to the complete form schema, not a custom JSON file
Hi @amits159
This error happens because you’re trying to read id from a JArray, but id belongs to an object inside the array, not the array itself.
Index the array or loop through it.
Example:
jsonData("tasks")(0)("id").ToString
or
Use For Each on the JArray and then read:
item("id").ToString
A JSON array doesn’t have fields — the objects inside it do. You must access an item first, then read id.
I’m not trying to find “id” in json. I’m passing the JSON file path as input to “Create Form Task” activity, which is giving Create Task: ‘Newtonsoft.Json.Linq.JArray’ does not contain a definition for ‘id’.
There’s no “id” in the JSON array stored in input file, but for some reason UiPath is looking for it.
Hi @amits159,
Export the form JSON directly from UiPath apps/form designer, or use the form property in create task and point it to the full schema not a custom json file
I’ve exported JSON from Form Designer only, but it’s giving error when i’m trying to load the same JSON file.
Ensure the JSON root is an object{}, not an array
When exporting the form data, UiPath saves it as json array. How can i save it as an object.
@amits159
always export data as a JSON array, even if the form contains only one set of values. There is no built-in setting in UiPath to directly export form data as a JSON object.
Use deserialize json then
CType(JArray.Parse(jsonString)(0), JObject)
Hope it help
Can you share the error ?