Closed gamerover98 closed 7 months ago
In addition, JSON schemas are a valid substitute for Beans. For example, with JSON, we have many more options compared to beans:
This list was generated using ChatGPT 🥇
I don't really understand your point. Your starting configuration is the same value as what ConfigMe ends up exporting, just written in different formats. In YAML, the following are exactly the same values:
json: |
{
"age": 30,
"city": "Rome",
"email": "john.doe@example.com"
}
json: "{\n \"age\": 30,\n \"city\": \"Rome\",\n \"email\": \"john.doe@example.com\"\ \n}\n"
Both YAML blocks will be read the same way by ConfigMe. We could come up with a way to define how string should be exported, as separate property type or as an option on StringProperty, which I'm sure would be useful for a wide array of applications. As for JSON-specific things, I don't think it makes much sense to have features out of the box in ConfigMe to mix JSON into YAML.
I don't really understand your point.
I'm sorry, I'll clarify. What I'm trying to say is that when you load the configuration that uses the pipe |
, ConfigMe compacts the multiple-lines string into one by replacing the newline with \n
, resulting in something like the following: json: "{\n \"age\"...
Both YAML blocks will be read the same way by ConfigMe
That's true, but the second one is not very readable.
We could come up with a way to define how string should be exported, as separate property type or as an option on StringProperty, which I'm sure would be useful for a wide array of applications.
Do you mean that we could decide whether to compress the string or keep the line breaks in the config? Perhaps we can check if the string property starts with the Literal Block Style |
or the Folded Block Style >
followed by a newline \n
.
I don't think it makes much sense to have features out of the box in ConfigMe to mix JSON into YAML.
No problem, I expected a response like that, but I still hoped for it 😄 Anyway, if we resolve this issue, we can manage the multiple strings as we want. For example the content of a Minecraft book and not necessarily a JSON or any type of multiple-line script.
In any case, I guess we can retitle this issue as "Multiple-line string not supported" or something like that.
What I'm trying to do
I'm attempting to include a JSON schema in a YAML property. Here's an example:
The issue
While ConfigMe reads this property correctly, it saves the config file with the JSON schema replaced by a string:
What I'm expected
I expect ConfigMe to load the JSON schema without replacing it with a string.
My test code
Perhaps we should create and use a
JsonProperty
class instead of aStringProperty
class.