Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Options
API: Parsing the "expression" string of the variable for the unit

I'm working on an integration where we deal a lot of with updating variables in a Variable Studio and regenerating a geometry. I was wondering if you'd be willing to share some knowledge or code on how you perform parsing of the "expression" string when converting it to the "value" string. As the title says, I am particularly interested in parsing out the unit string from the "expression".
Thanks!
Tagged:
0
Comments
I might not be following your question and this might not answer your question.
If you want to parse "json" it's best to use a prettyprint function to understand how to build an accessor.
pretty print function
This function will print an indented format allowing you to build a accessor
ie…. json.data[2].unit
println("unit "~json.data[2].unit); //"mm"
Thank you for the response. My question is about how to parse responses to the GET variables end point, where a single variable looks like, for instance:
In particular, I am finding it difficult to consistently identify the unit in the "expression", but I am now thinking about a different approach. I am left with these questions:
1. Is the "value" string always in SI (meters, rad)?
2. How is the unit determined for "value"? Could it have been meter*meter in my example for instance?
Thanks!