Here you can find the source of propertiesToJson(Properties properties)
public static Object propertiesToJson(Properties properties)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Object propertiesToJson(Properties properties) { Map<String, String> jsonObj = new HashMap<String, String>(); if (properties != null) { Set<String> keys = properties.stringPropertyNames(); for (String key : keys) { jsonObj.put(key, properties.getProperty(key)); }/*from w w w . j a v a 2 s .c o m*/ } return jsonObj; } }