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

Question: How would I specify CultureInfo.InvariantCulture alongside table.ToString("j") #133

Closed
RushkaVenter opened this issue Nov 12, 2021 · 3 comments · Fixed by #438
Closed
Milestone

Comments

@RushkaVenter
Copy link

Version: Parquet.Net v3.9.1

Runtime Version: .Net Core 3.1

OS: Windows/Linux/MacOSX v etc.

Expected behavior

When using ToString("j") on a Parquet.Data.Rows.Row object, the string should return a string formatted like a json string.

Actual behavior

When using ToString("j") on a Parquet.Data.Rows.Row object, the string returns a string formatted like a json string, however, the decimal values within the parquet is "12,5" and the json string looks like {"property_name": 12,5, "property_name_2: value} which is not a valid json string.

Normally you would be able to specify CultureInfo.InvariantCulture to get the decimals to convert as "12.5". How would you do that here?

Steps to reproduce the behavior

  1. Create an ParquetReader from a file with decimal values
  2. Read the parquet file as a table.
  3. Select the first row of the table
  4. Convert the the row to string
  5. Deserialize the json string

Code snippet reproducing the behavior

 using (var parquetReader = new ParquetReader(ms))
  {
      var table = parquetReader.ReadAsTable();
      var firstItem = table.FirstOrDefault();
      Console.WriteLine(firstItem.ToString("j"));
      var obj = JsonSerializer.Deserialize<ItemModel>(firstItem.ToString("j"));
  }
@aloneguid
Copy link
Owner

this is by design, you're welcome to improve it

@rachied
Copy link

rachied commented Dec 6, 2023

How is it by design to return broken JSON? And if a fix is welcomed, why not consider this a bug and keep the issue opened?
My team is also affected by this issue. We actually switched to this ToString() method because class deserialization also is broken due to #434

@aloneguid aloneguid reopened this Dec 6, 2023
@aloneguid
Copy link
Owner

Reopening it. Feel free to raise a PR, contributions are always welcome!

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

Successfully merging a pull request may close this issue.

3 participants