Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a json file in an another json file only with json

In xml i can include a file in a another xml file and use it. This is usefull if your software get the configuration file from xml but doesn't have any method to separate configuration like apache/ngnix(nginx.conf - site-available/ - site-enable/).

file A:

<!DOCTYPE icecast [
  <!ENTITY mount SYSTEM "mount.xml">
]>

<icecast>
    ...
    &mount;
    ...
</icecast>

file B:

<mount>
    <mount-name>/xyz</mount-name>
    <username>source</username>
    <password>password</password>
    <max-listeners>30</max-listeners>
    <hidden>0</hidden>
    <public>1</public>
    <no-yp>0</no-yp>
</mount>

But what if the configuration file is in json format? Is there a method equivalent?

I need to have a better organization of my couchbase-sync bucket configuration.

like image 722
jedi Avatar asked Jan 28 '16 16:01

jedi


1 Answers

There is no mechanism in JSON for including another file, like you describe. JSON is not a language in the sense that XML is, it's just the JavaScript object notation, so it only serves to describe application objects, nothing else.

like image 152
David Ostrovsky Avatar answered Nov 15 '22 04:11

David Ostrovsky