Search in sources :

Example 1 with ParseJson

use of loghub.processors.ParseJson in project LogHub by fbacchella.

the class TestToJson method test1.

@Test
public void test1() throws ProcessorException {
    Event e = Tools.getEvent();
    Processor t = new ParseJson();
    e.put("message", "{\"a\": [ 1, 2.0 , 3.01 , {\"b\": true} ] }");
    e.process(t);
    @SuppressWarnings("unchecked") Collection<Object> a = (Collection<Object>) e.get("a");
    a.stream().forEach((i) -> logger.debug(i.getClass()));
    logger.debug(e);
}
Also used : ParseJson(loghub.processors.ParseJson) Processor(loghub.Processor) Event(loghub.Event) Collection(java.util.Collection) Test(org.junit.Test)

Aggregations

Collection (java.util.Collection)1 Event (loghub.Event)1 Processor (loghub.Processor)1 ParseJson (loghub.processors.ParseJson)1 Test (org.junit.Test)1