Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing entry if key-name ends with dot #74

Open
j-moeller opened this issue Sep 11, 2023 · 0 comments
Open

Missing entry if key-name ends with dot #74

j-moeller opened this issue Sep 11, 2023 · 0 comments

Comments

@j-moeller
Copy link

Parsing and dumping a JSON object that contains a key which ends with a dot results in the respective entry missing from the output. I've build a minimal working sample to reproduce the behavior:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "frozen.h"

#define BUFFER_SIZE 8192

int run(const char* Data, size_t Size)
{
    char* json_buf = (char*)malloc(BUFFER_SIZE);
    if (NULL == json_buf) {
        return -1;
    }

    struct json_out out = JSON_OUT_BUF(json_buf, BUFFER_SIZE);
    if (0 > json_prettify(Data, Size, &out)) {
        free(json_buf);
        return -1;
    }

    printf("%s\n", json_buf);
    free(json_buf);

    return 0;
}

int main(int argc, char** argv) {
    run(argv[1], strlen(argv[1]));
}
clang -I ./frozen main.c frozen/frozen.c -o main
./main "{\"key\": 10, \"hidden.\": 20}"
Expected:
{
  "key": 10,
  "hidden.": 20
}

Actual:
{
  "key": 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant