Json unexpected end of string buggy character Ask Question

Just scraped some json from a webpage and now when I try to parse it using vscode I get an ‘unexpected end of string’ error on the “content” line:
Here’s the json

    "name": "Anna Vergnas",
    "date": "04/18/2018 4:30pm",
    "content": "L'appartement se situe au métro porte de Montreuil.Nous sommes au rez de chaussée d 'une belle et grande cour pavée, qui accueille volontier une baignade de soleil, des apéros au milieu des jardinières et . Cadre plutôt exceptionnel pour Paris, puisque vous avez un jardin et une terrasse dont vous profitez as you want (dans le respect de chacun).Pour plus d'
    info contactez moi en mp: )",
"number" : "null"}

Here’s part of the code using for scraping ( blocks is the div of the container):

let result = []

                let name = blocks[z].querySelector('.fwn.fcg') ? blocks[z].querySelector('.fwn.fcg').innerText : null
            let fb_url = blocks[z].querySelector('h5 a') ? blocks[z].querySelector('h5 a').href : null
            let date = blocks[z].querySelector('abbr') ? blocks[z].querySelector('abbr').title : null
            let content = blocks[z].querySelector('._5pbx.userContent._3576') ? blocks[z].querySelector('._5pbx.userContent._3576').innerText : null
            let number = blocks[z].querySelector('._5pbx.userContent._3576') ? blocks[z].querySelector('._5pbx.userContent._3576').innerText.replace(/s/g, '').match(/((+)33|0)[1-9](d{2}){4}/g) : null
            result.push({ name, fb_url, date, content, number, group_url})

Convert array inside JSON object into individual variables in javascript Ask Question

I have a JSON object that contains two arrays. I want to convert those array elements into individual elements in the JSON object.
I need this for an input into a D3 function in javascript.

My object now:


Converted object:


The number of variables can vary. It won’t always be 3.

Any help appreciated, Thanks

Create nested menu via 3 json files Ask Question

I am trying to make a nested menu from 3 json files, but In the first step I stuck, it return nothing:

var json = {};
$.getJSON("/api/category.json", function(data){
    json.category = data;

$.getJSON("/api/subcat.json", function(data){
    json.subcat = data;

$.getJSON("/api/subsubcat.json", function(data){
    json.subsubcat = data;

$.each(json, function(i,v) {
    console.log(json[i]); // it return nothing

But when I tried console.log(json) it return object, but even when I get console.log(json.category) It return nothing, no error in console log.

If I solve this issue I want to make a nested menu with this three json file in a loop, something like this:

var obj = '';

$.each(json.category, function(i, v) {
  obj += '<li data-id="' + data[i]['id'] + '"><a href="/browse/' + currentCity + '/' + slugSearch(data[i]['name']) + '">' + data[i]['name'] + '</a><ul>';

  $.each(json.subcat, function(i, v) {
    if (json.subcat["cat_id"] == json.category["id"]) {
      obj += '<li data-id="' + data[i]['id'] + '"><a href="/browse/' + currentCity + '/' + slugSearch(data[i]['name']) + '">' + data[i]['name'] + '</a></li>';

  obj += '</ul>';

  // also subsub cat

<ul class="simulate-cat"></ul>

json object to array, node.js Ask Question

I have a ETHBTC.json file :

    "open": "0.06353900",
    "high": "0.06354800",
    "low": "0.06341700",
    "close": "0.06347300",
    "volume": "335.48500000",
    "timestamp": 1521640800000
    "open": "0.06347300",
    "high": "0.06365400",
    "low": "0.06344000",
    "close": "0.06357500",
    "volume": "461.02800000",
    "timestamp": 1521641100000
    "open": "0.06349500",
    "high": "0.06360400",
    "low": "0.06341400",
    "close": "0.06352300",
    "volume": "495.50600000",
    "timestamp": 1521641400000

I’m trying to loop through the data and save all of the ‘low’ values to an array

const fs = require('fs');
var data = fs.readFileSync('charts/ETHBTC.json');
var CurrentPair = JSON.parse(data);

var lowTotal = [];

for(item in CurrentPair){
lowTotal[item] = item.low;
console.log(lowTotal[item]); //put this just to check if working.

the console log is giving me undefined values. Any help would be great, thanks

Adding element to an empty JSON object – Angular Ask Question

I have an empty JSON object

export class Car {}

I have imported it in a component.ts and I would like to add some fields in a loop. Something like

aux = new Car;
for (var i = 0; i < 10; i++) {
 car.addName("name" + i);

My goal would be to get at the end the following object

car: {
  name1: name1;
  name2: name2;

I have created the JSON object empty because at the beginning I do not know how many elements or fields will have. I could create this object by javascript. I do not need to have an export class

is it possible?

Getting invalid JSON on API call Ask Question

I’m trying to use GoToMeeting’s API and making a POST request to create a meeting. At the moment, I’m just trying to hardcode the body of the meeting and send headers but I’m receiving and I’m invalid JSON error and not sure why. Here’s the code for that route:

app.post('/new-meeting', (req, res) => {

  const headers = {
    'Content-Type': 'application/json',
    Accept: 'application / json',
    Authorization: 'OAuth oauth_token=' + originalToken

  console.log('Acess Token:');
  console.log('OAuth oauth_token=' + originalToken);

  const meetingBody = {
    subject: 'string',
    starttime: '2018-03-20T08:15:30-05:00',
    endtime: '2018-03-20T09:15:30-05:00',
    passwordrequired: true,
    conferencecallinfo: 'string',
    timezonekey: 'string',
    meetingtype: 'immediate'

  return fetch('https://api.getgo.com/G2M/rest/meetings', {
    method: 'POST',
    body: meetingBody,
    headers: headers
  }).then(response => {


      .then(json => {
      .catch(err => {

When I hit that router, I get the following error:

  "error": {
    "resource": "/rest/meetings",
    "message": "invalid json"

Any advice would be appreciated!

How to get dependecies from package.json for creating logical tree of the project? Ask Question

The goal of this question.We have many different projects, and it is often difficult and long to analyze the dependencies of each project.
Therefore, when developers, or the team gets a new project for them – they study for a long time, and investigate what is in dependence, etc.
I want to make a solution: use something like npm ls command.

In general, this command builds the dependency tree of the project,
our goal is to give a solution to the type npm ls, but it should be:
– be able to filter dependencies using a regular expression entered by the user
For example, i want to get result something like this enter image description here
I want to type something like this {path to the project} {expression for packet filtering}
I want to take the code npmls an create the function that check all dependecies in package.json and as a result print the object of dependecies.

Convert JSON string to HTML Ask Question

I have a json object which contains some HTML.
For example:

    "cat": "1",
    "catUrl": "this-is-a-url",
    "catSummary": "This is a summary with <a href="http://www.a.com">a link</a>"

Notice catSummary has an href in it. But it doesn’t get rendered as a link. Instead it just renders as regular text..

enter image description here

How do I make this work as a proper link?

Just to clarify, I am using the VueJS framework, not jQuery.
A simple solution (that I completely missed..) is using the v-html directive.

Cannot import Blender 2.79 JSON using THREE.js Ask Question

I am creating a 3D graph visualization in an Angular project using 3D Force Graph and need to use 3D models designed using Blender as nodes in the graph. I have tried the following code, but the imported object using three.js returns undefined, and the following warning is generated multiple times.

Offscreen-For-WebGL-0000014E33B8D990]RENDER WARNING: Render count or primcount is 0.

The code is as follows:

var self = this;
var loader = new THREE.JSONLoader();
var house = loader.load("assets/model/house.json",
    function ( obj ) {
      // After object is loaded      
      console.log("house -- "+house);     // returns undefined
      console.log("graph drawn");
    // onProgress callback
    function ( xhr ) {
      console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
    // onError callback
    function ( err ) {
      console.error( 'An error occurred -- '+err );
// function to draw the graph -- to be executed on 3D model load
showGraph(gData:any, house:any, themeNum: any){
    const Graph = ForceGraph3D()
      .nodeThreeObject(({ group }) => new THREE.Mesh(
          new THREE.BoxGeometry(Math.random() * 20, Math.random() * 20, Math.random() * 20),          
          new THREE.CylinderGeometry(Math.random() * 10, Math.random() * 10, Math.random() * 20),
          new THREE.DodecahedronGeometry(Math.random() * 10),
          new THREE.SphereGeometry(Math.random() * 10),
          new THREE.TorusGeometry(Math.random() * 10, Math.random() * 2),
          new THREE.TorusKnotGeometry(Math.random() * 10, Math.random() * 2)
        new THREE.MeshLambertMaterial({
          color: this.themes[themeNum][group],
          transparent: true,
          opacity: 0.75
        .onNodeClick(node => {    

Google Charts parse JSON via Javascript Ask Question

I am trying to use Google Charts and populate it using external JSON file, which I have created in PHP via json_encode().

So I got google charts working, with static random data from example, which is:

function drawChart() {
    var data = google.visualization.arrayToDataTable([
      ['Time', 'Temperature', 'Humidty'],
      ['2018-03-09 13:28:49',  1000,      400],
      ['2018-03-09 13:28:59',  1170,      460],
      ['2018-03-09 14:28:49',  660,       1120],
      ['2018-03-09 17:28:49',  1030,      540],
      ['2018-03-09 13:28:49',  1030,      540]

So basically as I understand var data should be replaced with entries from my JSON file, which is formatted in the following manner:

[{"id":"1","temp":"24.40","hum":"28.30","insert_date":"2018-03-09 13:28:49"},{"id":"2","temp":"24.50","hum":"28.60","insert_date":"2018-03-09 13:29:59"}]

So the data I need would be temp, hum and insert date. So, the question is how do I parse it?

I’ve been trying for hours and haven’t been able to figure it out.