Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. jsonlines and similar formats where each payload is stored as unindented JSON chunks divided by newlines are great for complex systems.
  2.  
  3. My application is more to aid in exploring large JSON files and copying/pasting, chunks in the editor, therefore made this small JSON stringifier that breaks the 1st level of arrays and objects with newlines,while returning valid JSON.
  4.  
  5. The placement of commas is intentional. This way one can find the item, right, shift+end, copy.
  6.  
  7. ```js
  8. jsonlishStringify([4,true,'yay'])
  9. `[
  10. 4
  11. ,true
  12. ,"yay"
  13. ]`
  14.  
  15. jsonlishStringify({a:4,b:true,c:'yay'])
  16. `[
  17. "a":4
  18. ,"b":true
  19. ,"c":"yay"
  20. ]`
  21. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement