Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[smila-user] SMILA: Pipelet outputs JSON

Hi all,

 

I have a rather easy (I guess) problem:

 

Until now, my pipelet was casting my computation results to Value objects and inserting them to the pipelet results, like this:

 

String output1 = “blah blah”;

Double output2 = 1.1;

 

Value outputValue1 = blackboard.getDataFactory().createStringValue(output);

blackboard.getMetadata(id).put("category", outputValue1);

 

Value outputValue2 = blackboard.getDataFactory().createDoubleValue(output2);

blackboard.getMetadata(id).put("score", outputValue2);

 

resultCollector.addResult(id);

 

 

 

Now, my output is a complex JSONObject casted to a String.

How do I add this to the pipelet results, not as String but as JSONObject?

Is it possible to have complex JSONObjects in the results? With complex I mean JSONObjects (and JSONArrays) inside of other JSONObjects (and JSONArrays).

If I add it as a String, it escapes all special characters (like / and “) and it looks like a mess.

It should be easy, since the pipelet output is already json.

 

Thanks,

 

Michalis

 

 


Back to the top