0

Java package read the JSON file with this data:

rytFeePayment.edit.currency: Currency
rytFeePlan.edit.rightTypesGrid.title: Usage Types
AvlReport.actions.addOisInMarketplace: Add to storefront
AvlReport.actions.createInnerDeal: Create Acquisition deal
AvlReport.actions.createSaleDeal: Create Sale deal
AvlReportsResult.grid.create_deal.warn: Attention with deal creation

Also in new project we using data in YAML format with below syntax:

rytFeePayment:
   edit:
      currency: 'Currency'
      rightTypesGrid:
         title: 'Usage Types'
AviReport:
   actions:
      addOisInMarketplace: 'Ádd to storefront'
      createInnerDeal: 'Create Acquisition deal'

etc..

As I understand I have to transform YAML data to JSON with syntax that I showed in firts case How to do that in command line?

Does jackson can help with it?

Justo
  • 1
  • 1
  • Does this one help? https://stackoverflow.com/questions/23744216/how-do-i-convert-from-yaml-to-json-in-java – rostIvan Nov 12 '22 at 19:10
  • Do you need to convert them programmatically? There are plenty of tools out there (online, IntelliJ, ...) that convert between those formats. – Turing85 Nov 12 '22 at 19:10
  • @rosIvan, in the app we using keys with view "rytFeePayment.edit.currency" - to create translation terms for interface. There is needed to create name of key from structure and back – Justo Nov 12 '22 at 19:24
  • @Turing85, yes we need to do that on server side – Justo Nov 12 '22 at 19:25
  • @Justo, Do you need this one, but in the oposite way (Convert tree-structured to dot notation keys YAML in Java)? https://stackoverflow.com/questions/40163376/convert-dot-notation-keys-to-tree-structured-yaml-in-ruby – rostIvan Nov 12 '22 at 20:05
  • The first file has nothing to do with JSON, it is a properties file. [This answer](https://stackoverflow.com/a/69303779/347964) has a `yq` command that implements this transformation. – flyx Nov 12 '22 at 21:23
  • Can’t you just use the YaML directly, I am confident that there is at least one, open-sourced YaML interpreter available for Java. Especially since Spring Boot uses YaML – Christoph Dahlen Nov 12 '22 at 22:42
  • @flyx, yep to me it also looks as [Properties File Format](https://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html) – rostIvan Nov 12 '22 at 22:47
  • @ChristophDahlen - oh, I have to check this idea. Thank you!!! – Justo Nov 13 '22 at 10:49

0 Answers0