JSON.stringify()

Jmnote (토론 | 기여)님의 2015년 8월 17일 (월) 18:09 판 (→‎같이 보기)

1 개요

JSON.stringify()
  • JSON을 문자열로 변환하는 JavaScript 함수

2 예시

<pre></pre>
<script src='//code.jquery.com/jquery.min.js'></script>
<script>
$('pre')
    .append( JSON.stringify({}) + "\n" )
    .append( JSON.stringify(true) + "\n" )
    .append( JSON.stringify('foo') + "\n" )
    .append( JSON.stringify( [1, 'false', false] ) + "\n" )
    .append( JSON.stringify( { x: 5 } ) + "\n" )
    .append( JSON.stringify( [1, 2, {a:'false', b:false}], "", "\t" ) );
</script>

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}