Error detected in JSON syntax... Where is it hiding?

After running the code through jsonlint, it flagged an error on line 17. However, upon close inspection of the file which contains about 1000 lines, I couldn't pinpoint the issue. It's possible that the problem lies further down the file, but I wanted to reach out to the community here for assistance since no errors are visible to me at the moment.

{
    "Blue Tag" : {
        "Queries" : {
            "DepartmentID" : {
                "name" : "Departments",
                "params" : ["1"],
                "options": []
            },
            "ZoneID" : {
                "name" : "Zones",
                "params" : [
                    "1",
                    "Department" : { // encountering an error in this section
                        "ref" : "true", 
                        "returns" : "value"
                    }
                ],
                "options": []
            },
            "MachineID" : {
                "name" : "Machines",
                "params" : [
                    "1",
                    "Department" : { 
                        "ref" : true, 
                        "returns" : "value"
                    },
                    "Zone" : { 
                        "ref" : true, 
                        "returns" : "value"
                    }
                ],
                "options": []
            }
        },
        "Emails" : ["*@*.com","*@*.com"],
        "PK" : "ID",
        "Table" : "BlueTags",
        "Connection" : "Safety"
    }
}

The specific error message received is as follows:

Parse error on line 17:
...        "Department": {                
-----------------------^
Expecting '}', ',', ']'

Answer №1

"settings" : [
    "1",
    "Department" : { 
        "ref" : "true", 
        "returns" : "value"
    }
]

This array is structured as a list, not an object. Replace the [] with {}

"settings" : { // <- By using curly brackets, we create an object with key:value pairs
    "1" : "",
    "Department" : { 
        "ref" : "true", 
        "returns" : "value"
    }
}

Alternatively, if you prefer to maintain the settings as an indexed array

"settings" : [ // <- Square brackets indicate an array containing values (which can also be objects)
    "1",
    {"ref" : "true", "returns" : "value"}
]

Answer №2

Maybe you simply overlooked adding brackets to enclose your objects within the params arrays

"params" : [
    "1",
    {"Department" : { 
        "ref" : true, 
        "returns" : "value"
    }},
    {"Zone" : { 
        "ref" : true, 
        "returns" : "value"
    }}
],

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

Troubleshooting problem with Shopify mailto tag

I am facing an issue with external links in my Shopify store. My app injects a script to display a bubble with an anchor tag that redirects users to a specified link. However, Shopify is altering the anchor tag to a different link, resulting in a 404 erro ...

Customizing error styles in a table using Jquery validation

My form is using JQuery .validation(). Here is the structure of my form: <form....> <table cellspacing="0" cellpadding="0"> <tr> <td>Name: </td> <td><input type='text' name='Name'/></td> ...

Implementing Angular *ngFor to Reference an Object Using Its Key

myjson is a collection of various hijabs and headscarves: [ { "support": 2, "items": [ [ { "title": "Segitiga Wolfis", "price": 23000, "descripti ...

There is no need for blank space when using the JSF inputtext component

When using a jsf form with required inputs, checking for empty spaces can be important. Utilizing the required="true" attribute helps, but it's also necessary to prevent users from submitting forms with just empty space characters entered. One approac ...

Guide to dynamically implementing pagination through AJAX calls

In this javascript code snippet, I have a class named PurchaseHistory. var baseUrl = null; var parameters = null; var currentPageNumber = null; var TotalPages = null; var PageSize = null; $(document).ready(function () { baseUrl = "http://localhost/AP ...

Navbar in bootstrap appears to be flashing when it is in its expanded

Example Link On smaller screens, the bootstrap navbar menu does not collapse by default when clicking on a menu item. To fix this issue, I added attributes data-toggle="collapse" and data-target="#navbar-collapse" to each menu item so that the menu will ...

Is it possible to compare escaped data with the unescaped value of a select box in JavaScript?

On my webpage, I have a functionality that involves fetching select box options through an AJAX request. I then create the select box based on this data, and later use the selected option to retrieve additional information from the response received via AJ ...

Identifying functions that contain dots in their names using JSHint

While running jshint on a JavaScript file, I encountered functions with dots in their names for namespacing purposes. Specifically, within the d3 library, there is a significant portion of code that resembles: d3.select("something") Should I simply disab ...

Error Encountered When Trying to Import BrowserAnimationsModule in Angular 5: Unexpected Token "<"

As I try to integrate the BrowserAnimationModule into my Angular 5 project, a rather foolish error keeps popping up. Error: (SystemJS) Unexpected token < SyntaxError: Unexpected token < at eval (<anonymous>) at Object.eval ...

$injector encountered a problem resolving the required dependency

Currently, I am attempting to adopt the LIFT protocol (Locate, Identify, Flat, Try(Dry)) for organizing my Angular projects. However, I am encountering difficulties in handling dependencies from other files. Here is the factory I have: (function () { ...

Tips for retrieving modified data from a smart table in Angular 4

Currently, I am working on an angular project where I am utilizing smart table. Here is a snippet of my .html file: <ng2-smart-table [settings]="settings" [source]="source" (editConfirm)="onSaveConfirm($event)" (deleteConfirm)="onDeleteConfirm($event ...

Divide the parsed rss findings into separate parts

I am in the process of developing a project that involves aggregating job listings from various websites by parsing their RSS feeds. I am utilizing rss-parser for this purpose. Each feed has its own format for the title field, resulting in varying structu ...

Inquiring about building a comprehensive AJAX website: SEO, Google index, design templates

I'm currently developing a fully AJAX-based website. My focus right now is on implementing page navigation and content display without the need for page reloading. Here's my approach: <html> <head> <!--CSS--> .hidde ...

Exploring the versatility of variables in sed scripting

One thing I'm curious about is parsing json with sed: Here's a snippet of the json response I'm dealing with: response='{"found":"true","downloadLink":"http:\/\/www.addic7ed.com\/updated\/1\/86593\/2"}&ap ...

Is it possible to include more than one ng-app directive on a single HTML page in AngularJS?

When working with Angular JS, I've noticed that I only get the desired output if I remove either the ng-app directive for demo1 or the models. It seems like having two ng-app directives active at the same time causes issues. As a beginner in Angular J ...

Having trouble getting an HTML form to work when making a PHP and Ajax request

I am trying to validate an HTML form using Ajax to prevent the browser from loading the page. Ideally, when a user enters their first name, it should display above the HTML form. However, I am encountering an issue where it is not showing up as expected... ...

Postman makes sending JSON requests via cURL seamless

I'm currently attempting to make a request using Postman to an API. Below is the request type that the API accepts: curl https://api.shoonya.com/NorenWClientTP/QuickAuth \ -d "jData={ \"apkversion\": \"1.0.0&bso ...

Create a nested struct definition in Golang and ensure it contains identical objects

Here is a struct that I am working with: type AutoGenerated struct { Accounting []struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` Age int `json:"age"` } `json:"accounting"` Sales []struct { FirstName string ...

Transforming Facebook data from JSON into structured objects using the JSON.NET library

One issue I am facing is that when I receive a list of posts from Facebook (page feed), there are times when multiple comments are stored in an array within the post object. Surprisingly, only the first comment of the post gets parsed correctly while the s ...

What is the best way to send a value through an AJAX request?

My ajax update function is not working in the code below. How can I solve this issue? The edit method in my code is functioning properly. For example, the value is being passed in this code snippet: var name = row.find(".ContactPersonName").find("span"). ...