title: javascript [object Object] to string
body: <p>I'll start with a little background.</p>
  
  <p>So what I'm trying to do is grabbing the "style" attribute from an element, and the eventual plan is to output it to a text box (the styling is dynamic). With this I'm creating some css prefixing, due to the fact that I'm only grabing computed styles. </p>
  
  <p>With that, I have a variable with a bunch of css properties as seen here:</p>
  
  <pre><code>compcss = {
                  'font-size': fsize,
                  'padding': tpadd,
  
                  '-webkit-border-radius': brad,
                  '-moz-border-radius': brad,
                  '-o-border-radius': brad,
                  '-ms-border-radius': brad,
                  'border-radius': brad,
  
                  'background': bground,
                  'background-m': bgmoz,
                  'background-o': bgop,
                  'background-i': bgie,
                  'color': 'white',
                  'text-shadow': '0 -1px 0 rgba(0, 0, 0, 0.25)',
                  'text-decoration': 'none',
                  'border': '1px solid rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25)',
  
              };
  </code></pre>
  
  <p>Normally fsize, tpadd, brad, and bground are filled with </p>
  
  <pre><code>document.defaultView.getComputedStyle(cssStr[0], "")[style]
  </code></pre>
  
  <p>but for the following jsbin I put in static numbers.</p>
  
  <p>This returns as <code>[object Object]</code> when logged or put into the text box, which is to be expected. However, I wish to get this object outputting as a string in the form:</p>
  
  <pre><code>font-size: Xpx;
  padding: Ypx;
  -webkit-border-radius: Zpx;
  </code></pre>
  
  <p>and so on, I've tried JSON.stringify(compcss), but that returns as:</p>
  
  <pre><code>"font-fize":"Xpx","padding":"Ypx","-webkit-border-radius":"Zpx"
  </code></pre>
  
  <p>all the way down the line.</p>
  
  <p>What is the best way to get this to output the way I want? Let me know if anything needs clarifying. Is there a better way of going about this?</p>
  
  <p>here's a jsbin for example: <a href="http://jsbin.com/opiwuy/2/edit" rel="noreferrer">http://jsbin.com/opiwuy/2/edit</a></p>
  
  <p>Both Vanilla Javascript and JQuery are fine.</p>
  
  <p>Thanks!</p>