Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9080847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:10:13+00:00 2026-06-16T20:10:13+00:00

I am using JSON for defining some configuration files and I want to validate

  • 0

I am using JSON for defining some configuration files and I want to validate them with json scheme. My problem is that I want to ensure that keys of some object should be subset of items of an array defined in same JSON:
ex:

Valid:

{
      "files": ["file1", "file2"],
      "filelocations": {
           "file1": "/etc/globalconfigs/file1.conf",
           "file2": "/usr/bin/file2.sh"
      }
}

Invalid (otherkey is not in files):

{
      "files": ["file1", "file2"],
      "filelocations": {
           "file1": "/etc/globalconfigs/file1.conf",
           "otherkey": "/usr/bin/file2.sh"
      }
}

etc. What I want is to ensure that keys of filelocations are found in files array.
Although in this example, we can change the structure of JSON by combining keys-values so that there is no need to have this kind of constraint, in my case I can’t change JSON like this, so it is nice to have a validation mechanism for this.

How can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:10:14+00:00Added an answer on June 16, 2026 at 8:10 pm

    You cannot achieve this with JSON Schema, there are no combination of keywords which can guarantee this.

    If you are adventurous (and I can even code that for you), you can use my JSON Schema API and code a custom keyword to fit your needs, however. It is doable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Json.NET to serialize an object graph. For each object that is
I want to build a RESTful WebService that's using JSON for externalizing resources. The
I am using json.net to parse objects and delivering them to a webservice I
I'm currently using json-framework and need some help though parsing some JSON i'm getting
I'm using JSON with Gson package for java. I have an object where there
I'm (trying to) using JSON with PHP. I want to plot a graph using
I'm defining a PUT request with a JSON request body using libcurl in C.
I'm using json +jquery on client side. I want to disable all buttons found
I'm using JSON.NET to de-serialize some JSON from a web service. I'm wanting to
I have an MVC 2 app that I want all requests to return json.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.