Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #### [OK] 1.rb
  2. ```ruby
  3. require "json"
  4.  
  5. def convert_to_json(obj)
  6. obj.to_json
  7. end
  8.  
  9. p convert_to_json(1) # => "1"
  10. p convert_to_json("x") # => "\"x\""
  11. ```
  12.  
  13. ```console
  14. % ruby 1.rb
  15. "1"
  16. "\"x\""
  17.  
  18. % crystal 1.rb
  19. "1"
  20. "\"x\""
  21. ```
Add Comment
Please, Sign In to add comment