title: How to store JSON data into database table in flutter using SQFLite or Moor Library
body: <p>How do I insert the list of String in database in flutter app, I tried saving it in string datatype by encoding the json array into the string, but then the skills array requires explicit decoding every time, like below whenever I need the object back from database.</p>
  
  <pre><code>List&lt;User&gt; userResponse = await tempDatabase.allItems;
        jsonData = Result.fromJson({
          "name": userResponse[0].name,
          "skills": jsonDecode(userResponse[0].skills)
        });
  </code></pre>
  
  <p>This is my json response</p>
  
  <pre><code>{
    "result": [
      {
        "name":"Sidhant Rajora",
        "skills": [
          "C++",
          "Java",
          "Python",
          "React"
        ]
      },
      {
        "name":"Adity Rajora",
        "skills": [
          "C++",
          "Java",
          "Python"
        ]
      }
    ]
  }
  </code></pre>
  
  <p>I have this kind of JSON response and the model PODO created by it is like </p>
  
  <pre><code>class UsersJson {
    List&lt;Result&gt; result;
  
    UsersJson({this.result});
  
    UsersJson.fromJson(Map&lt;String, dynamic&gt; json) {
      if (json['result'] != null) {
        result = new List&lt;Result&gt;();
        json['result'].forEach((v) {
          result.add(new Result.fromJson(v));
        });
      }
    }
  
    Map&lt;String, dynamic&gt; toJson() {
      final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();
      if (this.result != null) {
        data['result'] = this.result.map((v) =&gt; v.toJson()).toList();
      }
      return data;
    }
  }
  
  class Result {
    String name;
    int id;
    List&lt;String&gt; skills;
  
    Result({this.name, this.skills});
  
    Result.fromJson(Map&lt;String, dynamic&gt; json) {
      name = json['name'];
      skills = json['skills'].cast&lt;String&gt;();
    }
  
    Map&lt;String, dynamic&gt; toJson() {
      final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();
      data['name'] = this.name;
      data['skills'] = this.skills;
      return data;
    }
  }
  </code></pre>
  
  <p>and now I am not sure about the approach should i take to insert the model into database and get it back from database.
  I have tried using the SQFLite library as well as Moor Library(<a href="https://moor.simonbinder.eu" rel="noreferrer">https://moor.simonbinder.eu</a>)</p>