Error in Oboe.js due to incorrect value

Originally posed by Sashkan in the Oboe.js Github issues:

Receiving a streamed response from a remote API. Upon making an ajax call, the response looks like this:

{"company_id":"3e1f975601f59090decc8f2d5ced72010162e481","airplane_type_id":"c10143316664f220a5cb87950b3dbac8794e2b15","legs":
[{"lfi_from":"FR49348","lfi_to":"FR24863","nb_pax":"1","datetime_from":"2015-12-10 15:45:00","datetime_to":"2015-12-10 16:44:00","duration":"00:59","availability":true}]},{"company_id":"3e1f975601f59090decc8f2d5ced72010162e481","airplane_type_id":"opfr8976xwqs54321zdickv678654xckvjfdf025","legs":
[{"lfi_from":"FR49348","lfi_to":"FR24863","nb_pax":"1","datetime_from":"2015-12-10 15:45:00","datetime_to":"2015-12-10 16:45:00","duration":"01:00","availability":true}]},{"company_id":"3e1f975601f59090decc8f2d5ced72010162e48e","airplane_type_id":"2368c24e9980e4eb9ccd986f32df884e5bd58707","legs":
[{"lfi_from":"FR49348","lfi_to":"FR24863","nb_pax":"1","datetime_from":"2015-12-10 15:45:00","datetime_to":"2015-12-10 16:50:00","duration":"01:05","availability":true}]}

However, while using oboe, only the first one is displayed, followed by an oboe error:

thrown: Error: Bad value Ln: 1 Col: 65 Chr: , at Error (native) at emitError (http://openjetfrontclean/app_dev.php/bundles/main_oboe-browser_9.js:636:20) at handleData (http://openjetfrontclean/app_dev.php/bundles/main_oboe-browser_9.js:816:20) at applyEach (http://openjetfrontclean/app_dev.php/bundles/main_oboe-browser_9.js:497:20) at emit (http://openjetfrontclean/app_dev.php/bundles/main_oboe-browser_9.js:2042:10) at XMLHttpRequest.handleProgress (http://openjetfrontclean/app_dev.php/bundles/main_oboe-browser_9.js:1253:10)
    message: "Bad value↵Ln: 1↵Col: 65↵Chr: ,"
    stack: (...)
    get stack: ()
    set stack: ()
    __proto__: DefineError.bh

Any thoughts on why this is happening?

Answer №1

Answer by JohnSmith

In my opinion, the provided response appears to be invalid JSON. You can confirm this by pasting it into the validator at http://jsonlint.com/. It seems to consist of three separate objects separated by commas. Perhaps it was intended to be an array? If so, consider adding a [ before the first object and a ] after the last object.

Remember, Oboe has the capability to extract elements from a main array. Simply use the .node('[*]', function(){...}) method.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The incremental BR tag counter seems to be malfunctioning, there appears to be a missing element

Can anyone help me with the following code? I'm trying to add an incremental counter next to each BR tag in a lyric song, but it doesn't seem to be working as expected. <?php $lyrics = "<p>Every time when I look in the ...

Can you offer advice on creating jasmine tests for an Angular controller and service similar to this?

I've been struggling with this issue for hours, mainly because I'm still new to Jasmine and AngularJS. The problem lies within my controller. angular.module('toadlane.controllers', []). controller('MainController', functi ...

Display a series of numbers in a stylish Bootstrap button with uniform dimensions

I am trying to find a way to show the number of days in a specific month within a bootstrap button. However, the code I have been using does not evenly distribute the buttons in terms of height and width. I would like the display to look similar to the sc ...

Choosing a String and Performing a Double Click in Selenium with Java

My textbox is disabled, and it includes the following attributes: <div id="writingactivityId2" class="boxSize ng-pristine ng-untouched ng-valid ng-valid-required redactor_editor writingActivityDisabled" ng-focus="editing()" redactor="" readonly="" ng- ...

Using JavaScript to add a Vue component and display it on a page

I am working with a Vue component that is imported in a component file. My goal is to render another component using the append function. How can I achieve this? <template> <JqxGrid :width="width" :source="dataAdapter" :columns="gridValues" ...

Click event recursion occurs due to the use of $.post

I have a collection of product rows available for customers to select from. Each row is designated with the class "product-line". Upon clicking on a row, I aim to visually indicate its selection status by toggling the "product-checked" class, and subsequen ...

Generating an order prior to payment being made by the customer

When a user selects a product and clicks the pay button, they are redirected to Stripe where a new order is created. However, if the user changes their mind and cancels the payment during the Stripe checkout process, the order has already been created. How ...

Passing the socket.io instance to an express route

I am currently working on developing a nodejs application that will utilize various web APIs to search for information. The goal is to send the results to the client in real-time using socket.io, with jQuery handling the front end display of the data. Wha ...

Is there a way to trigger this pop-up after reaching a certain percentage of the page while scrolling?

I've been working on a WordPress site that features an "article box" which suggests another article to users after they scroll to a certain point on the page. However, the issue is that this point is not relative but absolute. This means that the box ...

retrieve the parent frame's request URL

I am faced with the task of writing a JSP code that retrieves the getRequestURL() of the parent frame (the URL shown in the address bar) from a child frame. However, when I attempt to do this, I only obtain the URL of the child frame. Is there anyone who ...

What are some techniques for concealing a CSS transition beneath another element in both directions?

Witness the magic in action! By clicking on the black box below, a larger black box will gracefully emerge from beneath the sidebar. While it may not be as clear in jsfiddle, rest assured that this effect is more pronounced in browsers. Thanks to some clev ...

Plugin for jQuery that smoothly transitions colors between different classes

After searching through numerous jQuery color plugins, I have yet to discover one that allows for animating between CSS class declarations. For instance, creating a seamless transition from .class1 to .class2: .class1 { background-color: #000000 } .class ...

Tips for validating multiple forms on a single page without altering the JavaScript validation structure

My JSP page currently consists of two forms: <body> <form id="1"></form> <form id="2"></form> </body> Only one form is visible at a time when the page is viewed. A JavaScript validation file is used to check the ...

The battle between Google Visualization API JSON and ArrayToDataTable in Python, a nightmare of data types

Initially, I developed a basic static google visualization page using python The python source code is as follows: def print_graph_script(temp_table): # google chart snippet chart_code=""" <script type="text/javascript" src="https://www.g ...

Modify the input class once an image has been chosen (But not yet submitted)

Looking for a solution to update background image when file is selected <input type="file" class="imgupload" name="file" /> I've created image uploader with a hidden form element inside a padded div, displaying a background image. Want to chan ...

Why is $(window).load() being executed twice?

When using $(window).load() to resize images in a thumbnail gallery and set up a slideshow, the code seems to be running twice. This can be observed by noticing that a div is being wrapped around another div twice when inspecting the HTML on page load. Af ...

How can audio be efficiently streamed to the browser in small chunks using JavaScript?

I am currently working on setting up an internet radio station where I want to easily switch songs and overlay sounds. My goal is to limit the audio rate so that the feed can be adjusted before being sent out. Additionally, I would like to provide continuo ...

Working with Variables in Handlebars with Node.js

Is it possible to reference an object key with a space in a handlebars view? The specific key is "Record Number" within the object, but I am encountering difficulties when trying to reference it in the view. Here's the code snippet from the view: {{# ...

Utilizing cookies to track the read status of articles - markers for reference

Currently, I am in the process of developing a website and am interested in implementing a feature that allows users to track which articles they have read. I am considering adding a small circle next to each article heading to signify whether it has been ...

Angular UI-Select's issue with duplicating tags while adding objects for tagging functionality

I have implemented the ui-select library to enable the "Tagging" feature in my project. Currently, I am utilizing an Array of objects where each object contains an id and a name. The functionality is working as expected. However, when a user types in a n ...