My last topic to this was this thread and I was very happy about the activity updates.
To my questions
Giving UiPath.Web.Activities.DeserializeJSON (hereinafter referred to as DJ) a sample leads to the creation of classes from UiPath.Web.Activities.ViewModels.SWEntities with generic Names like DeserializeJSON<“HASHVALUE”>.
The cool thing, if your JSON sample structure also contains nested objects, this generic classes are very smart, especially if you need more complex structured variables in your process, containing type defined attributes like from typical class definitions. To use these generic class definitions as in/out/inout argument types is awesome.
But here is the thing
In case your sample has to be updated, a new SWEntities generic class structure is generated to output and store the activity output of DJ. In order to run the code, all occurancies of defining variables or arguments with one of the former sample classes, will run into type missmatching exceptions. Updating these opccurancies in your entire project is kind of pain in the ***.
Is there a smart way to do so? I really hope someone has a very good idea that already proofed itself. Even, if someone is saying: “Hey Christian, you just missed this thing in UiPath Studio called …” would be awesome XD
Gave this some thought - I would consider two options:
Option 1: Instead of using the hash-named class directly as your argument type, immediately after “DeserializeJSON” map its output into your own handwritten class (e.g. a .cs file in a custom activity library or a VB module in your project). Your workflow arguments and variables always reference your class, not the “SWEntities” hash class. When the JSON sample changes, you only update the mapping in one place, not across the entire project.
Option 2: Use JObject or dynamic typing If the JSON structure is volatile and you don’t need strong typing, skip “DeserializeJSON” classes entirely. Use Newtonsoft.Json.Linq.JObject directly and navigate values with .SelectToken("$.path.to.value"). No classes, no hash names, no type mismatches.
Just remember, treat the “DeserializeJSON” activity as a parsing layer only. Never let its generated type go beyond a single wrapper workflow or mapping step. It’s pretty much a DTO at that point where the hash class is an implementation detail, not a contract.
This is a known limitation of autogenerated SWEntities classes in Deserialize JSON .
When the JSON sample changes, UiPath creates new hash-based classes, causing type mismatch issues.
A better approach is using JObject/JToken or custom classes instead of relying heavily on autogenerated types.
So the reply above, which I strongly suspect is AI generated, came close.
Basically, the activity right now is inferring a data type and building that dynamically, the nature of the data types they build mean they try to avoid naming conflicts across the project, so if you update the activity it can regenerate the data type and mess it up.
There is good news though. Write your own class or set of classes. You can do this with a coded Source File, this is like a coded workflow, but its not invokable, its just raw C# code that can be compiled and used anywhere in the project, so you can write the classes and just deserialize to that strong type. Because you control it, and the name/namespace, if you change it then it wont force you to reset the name across the entire project.
Previously, writing such classes were a chore. But now you can give your JSON to an LLM (like people do to forum posts :p) and ask it to build the classes. Make sure to tell it you need an empty constructor for each class, UiPath is more stable with coded source files when it has that.
It was not a compliment. I wish you would stop pasting AI generated content, especially if you don’t understand the content / results, such as suggesting writting a class in a ‘VB module in your project’, something that doesnt exist in UiPath and is clear LLM hallucinations.
Its pretty obvious.
I get you are chasing post count, either for the monthly rewards, or perhaps another purpose such as perhaps applying for an MVP next year, but we’ll see the difference between quality and quantity in the interviews.
Unfortunately for you, I do not use AI in my responses, hence the compliment. If you knew me or worked with me, you would understand that I am a very articulate and structured speaker. Through most of my research papers, statistics show that structuring content leads to a more comprehensive understanding of the question/use case etc. Which you find to be “AI Generated”.
I am certainly not “chasing” post count. I find pleasure in assisting the community, rather than rudely questioning their thinking methods or solutions.
You are absolutely right. Quality will prevail. I look forward to the interviews
That could be true, however your credibility is harmed when you post things like the following:
Perhaps you can explain in a structured manner what you meant by importing a VB Module into the UiPath project as it pertains to this post / reply? I might be wrong, and happy to concede if so and apologize, but its things like this that make me skeptical.
To be honest, I completely agree with your sentiment. All I meant by “VB Module” is simply VB.NET Code inside of an “Invoke Code” activity.
Under normal circumstances, I would have used “Invoke Code” in my explanation - but in this case, it was clear that the creator of the initial post/question has some software dev experience (beyond UiPath), so I used a more general development response because it may have made more sense.
All I was saying is that the root cause of the problem is that his variables and arguments are pointing directly at UiPath’s auto-generated hash class, so the solution is to stop referencing that hash class altogether and instead use a simple assign step that maps the output into a class that he can control. Either a “VB module” (Invoke Code with VB.NET inside) inside the Studio project, or a .cs file that get’s referenced.
And how does one use the class they generate in an Invoke code activity, outside of that activity, and reference it elsewhere in the project as the user is requesting, cause thats the crux of his issue right? That the ‘auto generated hash class’ is changes name too easily.
Can you show an example of what to write in the Invoke Code using VB.NET that would allow them to make that class and use it throughout the project?