I need to take raw client text in a web form and send it back to a Tomcat servlet as JSON. For legacy reasons, this input may be formatted as a Ruby hash. I also cannot force my clients to convert their existing Ruby formatted inputs over to JSON. I could write a custom parser, but I wanted to see if a JavaScript based solution existed that would allow me to determine if a blob of text is a Ruby hash and, if so, convert it into JSON.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
JSON is a Ruby standard library. You've to just require it:
Ref: Generating JSON