summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Interpreter.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-07 19:00:01 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-07 19:00:01 (GMT)
commit256ef5341a884df233bfd5338011250919f2c004 (patch)
treee98ac4abe01a22aef9ba7ecb57b68d46be14e22d /src/uscxml/Interpreter.cpp
parentce6f68d3a24759b9758ee0c5c2486ea53a1827af (diff)
downloaduscxml-256ef5341a884df233bfd5338011250919f2c004.zip
uscxml-256ef5341a884df233bfd5338011250919f2c004.tar.gz
uscxml-256ef5341a884df233bfd5338011250919f2c004.tar.bz2
JSON identification heuristic for content
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r--src/uscxml/Interpreter.cpp10
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;