# Parsing object to array/Getting name of an object attribute

**URL:** <https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759>\
**Category:** Coding Questions\
**Created:** [June 17, 2021, 10:24am UTC](https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759 "2021-06-17T10:24:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [June 17, 2021, 10:24am UTC](https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759/1 "2021-06-17T10:24:13Z")

</div>

Hello everyone, I had an idea to try to make a tool for saving the state of a running program on processing, which could be applied by adding just a couple of lines, I would call it “quick save”. The problem is that in any code there are different objects (containing data variables) that we want to store.  
I can’t just take an object and transform it into a JSONObject (to save it as a .json file) and vice versa, as it does in JavaScript.  
Question: Is it possible to get the attributes of an object in the form of a list of names and refer to an attribute of an object by name.  
It might look like this:

```auto
class Like
{
  int id = 0; // 0
  String members = "mem e"; //1
  int Partition = 3; // 2
  boolean flag = fasle; // 3
  Like () {}
}
Like objectLike = new Like ();
String temp = functionTakesNameOfObjectAttribute (objectLike, 2); // fuction result "Partition", because it is in second place in the class.
int countPartick = functionGetValueToObjectAttribute (objectLike, temp); // read the value of an object variable into a local variable
functionSetValueToObjectAttribute (objectLike, temp, countPartick+1); // value Partition becomes "4"

```

Is it generally possible to interact with objects in Processing more than is available in Processing itself?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [June 17, 2021, 11:40am UTC](https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759/2 "2021-06-17T11:40:18Z")

</div>

Interesting

Maybe [Get functions / variables / classes from processing and user](https://discourse.processing.org/t/get-functions-variables-classes-from-processing-and-user/30100)

---

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [June 17, 2021, 11:53am UTC](https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759/3 "2021-06-17T11:53:15Z")

</div>

Its awesome, anytime i check this opportunity. But I dont know, why this tread dont be in search results 🤔  
this looks like the solution I need, if this is it I will tag your message, thanks again!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [June 17, 2021, 4:40pm UTC](https://discourse.processing.org/t/parsing-object-to-array-getting-name-of-an-object-attribute/30759/4 "2021-06-17T16:40:44Z")

</div>

I think your idea is really cool

But I don’t know if it’s possible
