Giter Club home page Giter Club logo

Comments (5)

fidley avatar fidley commented on June 15, 2024 1

Now after clicking Convert you'll get selection screen for the pretty name mode. I've put there all possible modes from /ui2/cl_json, but not sure what's the difference between all of them.

image

But at least you can get rid here of the underscore in case of Camel Case ( use Lower Case option).
image

from json2abaptype.

fidley avatar fidley commented on June 15, 2024

Hello Andreas,
this is normal. The standard SAP class is changing the names the way it uses underscore to separate the words in case the camel case is used.

I'm not 100% sure if this was the issue on my side as well but I had to prepare mapping in order to deserialize correctly some of the JSONs that have for example long names (more then 32 characters).

In such cases I was calling deserialize in this way:


  /ui2/cl_json=>deserialize(
      exporting
        json             = json
        pretty_name      = /ui2/cl_json=>pretty_mode-extended
        name_mappings    = value #(
                                    ( abap = 'microsoft_vsts_cmmi_blocked'    json = 'Microsoft.Vsts.Cmmi.Blocked'    )
                                    ( abap = 'microsoft_vsts_cmmi_committed'  json = 'Microsoft.Vsts.Cmmi.Committed'  )
                                    ( abap = 'microsoft_vsts_cmmi_requiremen' json = 'Microsoft.Vsts.Cmmi.Requiremen' )
                                    ( abap = 'microsoft_vsts_common_priority' json = 'Microsoft.Vsts.Common.Priority' )
                                    ( abap = 'microsoft_vsts_common_state_ch' json = 'Microsoft.Vsts.Common.State.ChangeDate' )
                                    ( abap = 'microsoft_vsts_common_triage'   json = 'Microsoft.Vsts.Common.Triage'   )
                                    ( abap = 'microsoft_vsts_scheduling_orig' json = 'Microsoft.VSTS.Scheduling.OriginalEstimate' )
                                    ( abap = 'microsoft_vsts_scheduling_comp' json = 'Microsoft.VSTS.Scheduling.CompletedWork' )
                                    ( abap = 'microsoft_vsts_scheduling_rema' json = 'Microsoft.VSTS.Scheduling.RemainingWork' )
                                    ( abap = 'system_area_id'                 json = 'System.AreaId'                 )
                                    ( abap = 'system_area_level1'             json = 'System.AreaLevel1'             )
                                    ( abap = 'system_area_path'               json = 'System.AreaPath'               )
                                    ( abap = 'system_assigned_to'             json = 'System.AssignedTo'             )
                                    ( abap = 'system_authorized_as'           json = 'System.AuthorizedAs'           )
                                    ( abap = 'system_authorized_date'         json = 'System.AuthorizedDate'         )
                                    ( abap = 'system_board_column'            json = 'System.BoardColumn'            )
                                    ( abap = 'system_board_column_done'       json = 'System.BoardColumnDone'       )
                                    ( abap = 'system_changed_by'              json = 'System.ChangedBy'              )
                                    ( abap = 'system_changed_date'            json = 'System.ChangedDate'            )
                                    ( abap = 'system_created_by'              json = 'System.CreatedBy'              )
                                    ( abap = 'system_created_date'            json = 'System.CreatedDate'            )
                                    ( abap = 'system_description'             json = 'System.Description'             )
                                    ( abap = 'system_id'                      json = 'System.Id'                      )
                                    ( abap = 'system_iteration_id'            json = 'System.IterationId'            )
                                    ( abap = 'system_iteration_level1'        json = 'System.IterationLevel1'        )
                                    ( abap = 'system_iteration_path'          json = 'System.IterationPath'          )
                                    ( abap = 'system_node_name'               json = 'System.NodeName'               )
                                    ( abap = 'system_person_id'               json = 'System.PersonId'               )
                                    ( abap = 'system_reason'                  json = 'System.Reason'                  )
                                    ( abap = 'system_rev'                     json = 'System.Rev'                     )
                                    ( abap = 'system_revised_date'            json = 'System.Revised.Date'            )
                                    ( abap = 'system_state'                   json = 'System.State'                   )
                                    ( abap = 'system_team_project'            json = 'System.TeamProject'            )
                                    ( abap = 'system_title'                   json = 'System.Title'                   )
                                    ( abap = 'system_watermark'               json = 'System.Watermark'               )
                                    ( abap = 'system_work_item_type'          json = 'System.WorkItemType'          )

                                        )
      changing
        data             =    r_results
    ) ##NO_TEXT.
 

from json2abaptype.

andkopp avatar andkopp commented on June 15, 2024

When I manually remove the underlines of the generated type, everything works fine. This is the workaround I will implement.
Maybe extend this project with an additional parameter to control if camel case should be converted to underline or not?

from json2abaptype.

fidley avatar fidley commented on June 15, 2024

Maybe extend this project with an additional parameter to control if camel case should be converted to underline or not?

Could be a good solution. Will try to implement this, when I will reinstall my DEV system.

from json2abaptype.

andkopp avatar andkopp commented on June 15, 2024

Thank you for the quick implementation. It works as expected.

A hint from my side: I had to import several snotes for /ui2/cl_json in my 7.52 NetWeaver system in order to activate the report because for example /ui2/cl_json=>pretty_mode-user was not available in my system before I upgraded the system.

from json2abaptype.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.