title: use kiiObject to save user data
body: <p>In my app, every KiiUser has one hash table of data. But I have some problems using KiiObject to save data and get it next time.
  I want to create an KiiObject with a specific URI when user registers so every time he logins I can import it with </p>
  
  <pre><code>KiiObject.objectWithURI(&lt;URI&gt;)
  </code></pre>
  
  <p>Alternatively, how to use objectWithJSON().
  I don't want to use kiiQuery if I can avoid, as there is only one object for each user.</p>
  
  <p>Can anyone give me an example of code how to create this Kiiobject when user registers and how to edit it every time he logins ; or every time he edits it and saves.
  that's some of my current code but i don't get always the saved data back (the  saved hash table "data" undefined on the object)</p>
  
  <pre><code>    function performRegistration() {
      try {
          var user = KiiUser.userWithUsername(&lt;username&gt;, &lt;password&gt;);
          user.register({
              success: function(Auser) {
                  var bucket = Auser.bucketWithName("data");
                  data = bucket.createObject();
                  data.set("data", {});
                  data.saveAllFields({
                              success: function(theObject) {
                                  console.log("Object saved!");
                                  theObject.refresh({success:function(obj){
                                      data=obj;
                                       [....
                                       ...Some Code here to edit the...
                                       ...data object and save it....
                                        ...]
                                      Kii.logger("User registered: " + Auser);
                                  }});
                              },
                              failure: function(theObject, errorString) {
                                  console.log("Error saving object: " + errorString);
                              }
                          });
  
              },
              failure: function(theUser, anErrorString) {
                  alert("Unable to register: " + anErrorString);
                  Kii.logger("Unable to register user: " + anErrorString);
              }
          });
      } catch (e) {
          alert("Unable to register: " + e.message);
          Kii.logger("Unable to register user: " + e.message);
      }
  }
  
  // the user clicked the 'sign in' button
  function performLogin() {
      KiiUser.authenticate(&lt;username&gt;, &lt;password&gt;, {
          success: function(Auser) {
              user = Auser;
              var bucket = user.bucketWithName("data"); // a KiiBucket
               var query = KiiQuery.queryWithClause();
               var queryCallbacks = {
               success: function(queryPerformed, r, nextQuery) {
                   console.log(r.constructor.name,r);
                   r[0].refresh({success:function(obj){
                       data=obj;
                       if(data.get("data")==undefined){
                           data.set("data",{});
                       }
                       data.save({success:function(Sobj){
                           data=Sobj;
                           [...
                           ...some data object manipilation then save it
                           ...]
                       }});
  
                   }});
               },
               failure: function(queryPerformed, anErrorString) {
               }
               };
  
               bucket.executeQuery(query, queryCallbacks);
          },
          // callback for failed registration
          failure: function(theUser, anErrorString) {
              alert("Unable to register: " + anErrorString);
              Kii.logger("Unable to register user: " + anErrorString);
          }
      });
  
  };
  Kii.initializeWithSite(&lt;...&gt;, &lt;...&gt;, KiiSite.US);
  [...
  other code
  ...]
  </code></pre>