@@ -0,0 +1,2068 @@
+/**%0A * Copyright 2017 Telefonica Investigaci%C3%B3n y Desarrollo, S.A.U%0A *%0A * This file is part of BigDataResources.%0A *%0A * BigDataResources is free software: you can redistribute it and/or modify it under the terms of the GNU Affero%0A * General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your%0A * option) any later version.%0A * BigDataResources is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the%0A * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License%0A * for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License along with BigDataResources. If not, see%0A * http://www.gnu.org/licenses/.%0A *%0A * For those usages not covered by the GNU Affero General Public License please contact with iot_support at tid dot es%0A */%0Apackage com.telefonica.iot.bigdata.utils;%0A%0Aimport org.apache.hadoop.io.Text;%0Aimport org.json.simple.JSONArray;%0Aimport org.json.simple.JSONObject;%0Aimport org.json.simple.JSONValue;%0Aimport org.json.simple.parser.JSONParser;%0Aimport org.json.simple.parser.ParseException;%0A%0A/**%0A *%0A * @author frb%0A */%0Apublic class Utils %7B%0A    %0A    public static JSONObject parseRecord(Text record) %7B%0A        JSONParser parser = new JSONParser();%0A%0A        try %7B%0A            return (JSONObject) parser.parse(record.toString());%0A        %7D catch (ParseException e) %7B%0A            return null;%0A        %7D // try catch%0A    %7D // parseRecord%0A    %0A    public static String serializeJsonValue(Object value) %7B%0A        if (value instanceof String) %7B%0A            return (String) value;%0A        %7D else if (value instanceof Number) %7B%0A            return JSONValue.toJSONString(value);%0A        %7D else if (value instanceof JSONArray) %7B%0A            return ((JSONArray) value).toJSONString();%0A        %7D else if (value instanceof JSONObject) %7B%0A            return ((JSONObject) value).toJSONString();%0A        %7D else %7B%0A            return null;%0A        %7D // if else%0A    %7D // serializeJsonValue%0A    %0A%7D // Utils%0A

Add utils