diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-07 19:00:01 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-07 19:00:01 (GMT) |
commit | 256ef5341a884df233bfd5338011250919f2c004 (patch) | |
tree | e98ac4abe01a22aef9ba7ecb57b68d46be14e22d | |
parent | ce6f68d3a24759b9758ee0c5c2486ea53a1827af (diff) | |
download | uscxml-256ef5341a884df233bfd5338011250919f2c004.zip uscxml-256ef5341a884df233bfd5338011250919f2c004.tar.gz uscxml-256ef5341a884df233bfd5338011250919f2c004.tar.bz2 |
JSON identification heuristic for content
-rw-r--r-- | src/uscxml/Interpreter.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index c63ccc8..8c0b660 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -604,9 +604,13 @@ void InterpreterImpl::processContentElement(const Arabica::DOM::Node<std::string } if (contentToProcess.size() > 0) { /// try to interpret as JSON - data = Data::fromJSON(contentToProcess); - if (data) - return; + std::string trimmedContent = contentToProcess; + boost::trim(trimmedContent); + if (trimmedContent.find_first_of("{[") == 0) { + data = Data::fromJSON(contentToProcess); + if (data) + return; + } /// create space normalized string std::istringstream iss(contentToProcess); std::stringstream content; |