Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript stringify line breaks

const data = {  
  name: 'foo',
  date: new Date(),
  data: [
    {
      question: 'What is the meaning of '+typeof(any),
      answer: 42
    }
  ]
}

console.log(  
  JSON.stringify(data, null, 2)	// null - no formatter, 2 - spaces per indentation
)
 
PREVIOUS NEXT
Tagged: #javascript #stringify #line #breaks
ADD COMMENT
Topic
Name
4+4 =