All we do is transform the table into json and reutrn a JSONDataSource
9636
function ElementDataSource(config) {
	var newData = [],
		newColumns = [];

	var headings = config.data.all('tr th');

	headings.each(function(th){
		newColumns.push(th.getHtml());
	});

	config.data.all('tr').each(function(tr){
		var newRow = {},
			populated = false;

		for (var i = 0, numCols = headings.size(); i < numCols; i++) {

			if (!tr.all('td').item(i)) { continue; }

			newRow[headings.item(i).getHtml()] = tr.all('td').item(i).getHtml();
			populated = true;
		}

		if (populated) {
			newData.push(newRow);
		}
	});

	config.columns = newColumns;
	config.data = newData;

	return new JSONDataSource(config);
}
1286741
private String convertToJson(Map<String, ?> map) throws MovieDbException {
        try {
            return MAPPER.writeValueAsString(map);
        } catch (JsonProcessingException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "JSON conversion failed", "", ex);
        }
    }
781248
private static void selectJsonColumn(CqlSession session) {

    Statement stmt =
        selectFrom("examples", "json_jackson_column")
            .all()
            .whereColumn("id")
            .in(literal(1), literal(2))
            .build();

    ResultSet rows = session.execute(stmt);

    for (Row row : rows) {
      int id = row.getInt("id");
      // retrieve the JSON payload and convert it to a User instance
      User user = row.get("json", User.class);
      // it is also possible to retrieve the raw JSON payload
      String json = row.getString("json");
      System.out.printf(
          "Retrieved row:%n id           %d%n user         %s%n user (raw)   %s%n%n",
          id, user, json);
    }
  }
434460
def to_json(self):
        
        endpoints = []
        for endpoint in self.endpoints:
            list_fields = endpoint.fields
            resource_type = endpoint.Meta.resource_type
            table = endpoint.Meta.table

            data = endpoint.to_dict()
            data['fields'] = resource_type.get_type_of_fields(
                list_fields,
                table,
            )
            endpoints.append(data)

        data = {
            'title': self.title,
            'endpoints': sorted(endpoints, key=lambda x: x['name']),
        }

        return json.dumps(data)
876207
def as_json(data, **kwargs):
    

    if 'sort_keys' not in kwargs:
        kwargs['sort_keys'] = False
    if 'ensure_ascii' not in kwargs:
        kwargs['ensure_ascii'] = False

    data = json.dumps(data, **kwargs)

    return data
786730
def to_json(df, state_index, color_index, fills):
        """"""
        records = {}
        for i, row in df.iterrows():

            records[row[state_index]] = {
                "fillKey": row[color_index]
            }

        return {
            "data": records,
            "fills": fills
        }
1294546
public JsonNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();

		ArrayNode columnsNode = mapper.createArrayNode();
		for (DataColumn column : columns) {
			columnsNode.add(column.toJson());
		}
		ArrayNode dataNode = mapper.createArrayNode();
		for (DataRow row : rows) {
			dataNode.add(row.toJson());
		}

		node.put("columns", columnsNode);
		node.put("data", dataNode);
		node.put("overwrite", overwritePolicy.toJson());
		if (templateId != null) {
			node.put("templateId", templateId);
		}
		if (splitByColumn != null) {
			node.put("splitByColumn", splitByColumn);
		}
		return node;
	}
135577
@Override
    public String toJSON() {
        final ObjectMapper mapper = buildObjectMapperForSerialization();
        try {
            return mapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            throw new IllegalStateException("Object cannot be parsed as JSON.", e);
        }
    }
437914
def as_json(context):
    """"""
    info = {
        'info': cgi.escape(pprint.pformat(context.context)),
    }
    return Response(content_type='application/json', body=json.dumps(info))
714344
def QA_util_to_json_from_pandas(data):
    """"""
    if 'datetime' in data.columns:
        data.datetime = data.datetime.apply(str)
    if 'date' in data.columns:
        data.date = data.date.apply(str)
    return json.loads(data.to_json(orient='records'))
1212774
@SuppressWarnings("unchecked")
    private void toJson(MarcRecord marcRecord, StringBuilder sb) {
        if (marcRecord.isEmpty()) {
            return;
        }
        if (top) {
            top = false;
            if (style == Style.ELASTICSEARCH_BULK) {
                writeMetaDataLine(marcRecord);
            }
        } else {
            switch (style) {
                case ARRAY:
                    sb.append(",");
                    break;
                case LINES:
                    sb.append("\n");
                    break;
                case ELASTICSEARCH_BULK:
                    sb.append("\n");
                    writeMetaDataLine(marcRecord);
                    break;
                default:
                    break;
            }
        }
        sb.append("{");
        int c0 = 0;
        for (Map.Entry<String, Object> tags : marcRecord.entrySet()) {
            if (c0 > 0) {
                sb.append(",");
            }
            String tag = tags.getKey();
            sb.append("\"").append(tag).append("\":");
            Object o = tags.getValue();
            if (o instanceof Map) {
                int c00 = 0;
                Map<String, Object> repeatMap = (Map<String, Object>) o;
                sb.append("[");
                for (Map.Entry<String, Object> repeats : repeatMap.entrySet()) {
                    if (c00 > 0) {
                        sb.append(",");
                    }
                    o = repeats.getValue();
                    if (!(o instanceof List)) {
                        o = Collections.singletonList(o);
                    }
                    List<?> list = (List<?>) o;
                    if (list.size() > 1) {
                        sb.append("[");
                    }
                    int c1 = 0;
                    for (Object value : list) {
                        if (c1 > 0) {
                            sb.append(",");
                        }
                        if (value instanceof Map) {
                            sb.append("{");
                            int c2 = 0;
                            for (Map.Entry<String, Object> indicators : ((Map<String, Object>) value).entrySet()) {
                                if (c2 > 0) {
                                    sb.append(",");
                                }
                                String indicator = indicators.getKey();
                                sb.append("\"").append(indicator).append("\":");
                                o = indicators.getValue();
                                if (!(o instanceof List)) {
                                    o = Collections.singletonList(o);
                                }
                                List<?> list2 = (List<?>) o;
                                sb.append("[");
                                int c3 = 0;
                                for (Object value2 : list2) {
                                    if (c3 > 0) {
                                        sb.append(",");
                                    }
                                    if (value2 instanceof Map) {
                                        Map<String, Object> map = (Map<String, Object>) value2;
                                        int c4 = 0;
                                        for (Map.Entry<String, Object> subfield : map.entrySet()) {
                                            if (c4 > 0) {
                                                sb.append(",");
                                            }
                                            sb.append("{");
                                            sb.append("\"").append(subfield.getKey()).append("\":");
                                            if (subfield.getValue() instanceof List) {
                                                sb.append("[");
                                                int c5 = 0;
                                                for (String s : (List<String>) subfield.getValue()) {
                                                    if (c5 > 0) {
                                                        sb.append(",");
                                                    }
                                                    sb.append("\"").append(escape(s)).append("\"");
                                                    c5++;
                                                }
                                                sb.append("]");
                                            } else {
                                                sb.append("\"").append(escape(subfield.getValue().toString())).append("\"");
                                            }
                                            c4++;
                                            sb.append("}");
                                        }
                                    } else {
                                        sb.append("\"").append(escape(value2.toString())).append("\"");
                                    }
                                    c3++;
                                }
                                sb.append("]");
                                c2++;
                            }
                            sb.append("}");
                        } else {
                            if (value == null) {
                                sb.append("null");
                            } else {
                                sb.append("\"").append(escape(value.toString())).append("\"");
                            }
                        }
                        c1++;
                    }
                    if (list.size() > 1) {
                        sb.append("]");
                    }
                    c00++;
                }
                sb.append("]");
            } else {
                if (o == null) {
                    sb.append("null");
                } else {
                    sb.append("\"").append(escape(o.toString())).append("\"");
                }
            }
            c0++;
        }
        sb.append('}');
    }
510192
public SourceMap toJSON() {
        SourceMap map = new SourceMap();
        map.version = this._version;
        map.sources = this._sources.toArray();
        map.names = this._names.toArray();
        map.mappings = serializeMappings();
        map.file = this._file;
        map.sourceRoot = this._sourceRoot;
        if (this._sourcesContents != null) {
            map.sourcesContent = _generateSourcesContent(map.sources, this._sourceRoot);
        }
        return map;
    }
224852
private static String getJsonFromRaw(Context context, int resource) {
        String json;
        try {
            InputStream inputStream = context.getResources().openRawResource(resource);
            int size = inputStream.available();
            byte[] buffer = new byte[size];
            inputStream.read(buffer);
            inputStream.close();
            json = new String(buffer, "UTF-8");
        } catch (IOException ex) {
            ex.printStackTrace();
            return null;
        }
        return json;
    }
543260
private static String toJSON(Object data) {
        try {
            return mapper.writeValueAsString(data);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
598380
def to_table_data(self):
        

        self._validate_source_data()

        for table_key, json_records in six.iteritems(self._buffer):
            attr_name_set = set()
            for json_record in json_records:
                attr_name_set = attr_name_set.union(six.viewkeys(json_record))
            headers = sorted(attr_name_set)

            self._loader.inc_table_count()
            self._table_key = table_key

            yield TableData(
                self._make_table_name(),
                headers,
                json_records,
                dp_extractor=self._loader.dp_extractor,
                type_hints=self._extract_type_hints(headers),
            )
37408
static DataSetDto toDataSetDto(final String json) {
        try { return mapper.readValue(json, DataSetDto.class); }
        catch (IOException e) { throw new CalculationEngineException(e); }
    }
285800
public JsonNode toJsonObject() {
		ObjectNode node = new ObjectMapper().createObjectNode();
		if (id != null) {
			node.put("id", id);
		}
		for (DataColumn column : columns) {
			String value = content.get(column);
			if (value != null) {
				node.put(column.getCode(), value);
			} else {
				node.put(column.getCode(), "");
			}
		}
		return node;
	}