Skip to content

Conversation

@hanXen
Copy link
Contributor

@hanXen hanXen commented Sep 10, 2025

Resolves #679

Summary

This PR refactors FilterStructToMap to return a *mapsutil.OrderedMap[string, any] instead of a standard map[string]any.

The current function's use of a standard map results in non-deterministic key order when marshaled to JSON. By returning an OrderedMap, we leverage its custom MarshalJSON method to preserve the original struct field order, ensuring consistent output for downstream tools.

Impact Assessment

This change has a limited impact surface.

Overall, the modification makes the utility more robust while minimizing adjustments in dependent projects.

@Mzack9999 Mzack9999 self-requested a review September 15, 2025 13:05
@Mzack9999 Mzack9999 merged commit e8182af into projectdiscovery:main Sep 15, 2025
7 checks passed
@hanXen hanXen deleted the refactor/structs-orderedmap branch September 16, 2025 04:53
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 this pull request may close these issues.

Refactor FilterStructToMap for Deterministic JSON Output

2 participants