title: How to convert String value to Custom Model Object in Java?
body: <p>I have one Model Object. In which, i have multiple values. I want to store this Values in SQLite. But data is large, so i want to store Direct Model object
  in databse. So i convert model Object to string and store it into database.</p>
  
  <p>Now, Problem is that how to convert this String value to Model Object.
  If you have any idea, please share that with Me.</p>
  
  <p>For example,</p>
  
  <pre><code>Person p = new Person();
  p.setname("xyz");
  p.setage("18");`
  
  String person=p.toString();
  </code></pre>
  
  <p>Now How to get this "person" string back to <code>Person</code> "<code>p</code>" model object.</p>
  
  <p>This is my code.</p>
  
  <pre><code>ContentValues values = new ContentValues();
      String favorite_id = UUID.randomUUID().toString();
      values.put(EMuseumLocalData.KEY_FAVORITE_EXHIBITS_ID, favorite_id);
      values.put(EMuseumLocalData.KEY_EXHIBIT_SUBCATEGORY_ITEM_ID, Integer.parseInt(categoryByCustomerList.get(position).getSubCategoryItemID()));
      try {
          Gson gson = new Gson();
          String personString = gson.toJson(getAllCategory.get(position).toString());
          values.put(EMuseumLocalData.KEY_EXHIBIT_SUBCATEGORY_ITEM_DATA, personString);
  
          Gson gson1 = new Gson();
          CategoryByCustomer categoryByCustomer = gson1.fromJson(personString, categoryByCustomer.getName());
      } catch (JSONException e) {
          e.printStackTrace();
      }
  </code></pre>